From 850109e3ae47c3981a9ed3d1e0218cd02a291511 Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Mon, 13 Nov 2023 10:32:55 +0100 Subject: [PATCH 01/14] Use try-with-resources to close BatchHandler --- ...tCompleteDataSetRegistrationExchangeService.java | 8 ++++---- .../datavalueset/DefaultDataValueSetService.java | 13 +++++-------- dhis-2/pom.xml | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/dataset/DefaultCompleteDataSetRegistrationExchangeService.java b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/dataset/DefaultCompleteDataSetRegistrationExchangeService.java index a14e523ecd6b..d5b1b2b653d1 100644 --- a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/dataset/DefaultCompleteDataSetRegistrationExchangeService.java +++ b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/dataset/DefaultCompleteDataSetRegistrationExchangeService.java @@ -244,9 +244,9 @@ public ImportSummary saveCompleteDataSetRegistrationsJson( private ImportSummary saveCompleteDataSetRegistrations( ImportOptions importOptions, Callable deserializeRegistrations) { - BatchHandler batchHandler = - batchHandlerFactory.createBatchHandler(CompleteDataSetRegistrationBatchHandler.class); - try { + + try (BatchHandler batchHandler = + batchHandlerFactory.createBatchHandler(CompleteDataSetRegistrationBatchHandler.class)) { CompleteDataSetRegistrations completeDataSetRegistrations = deserializeRegistrations.call(); ImportSummary summary = saveCompleteDataSetRegistrations( @@ -256,7 +256,7 @@ private ImportSummary saveCompleteDataSetRegistrations( return summary; } catch (Exception ex) { - batchHandler.flush(); + log.error("Complete data set registrations could not be saved."); return handleImportError(ex); } } diff --git a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java index d338bd8b2e99..df29650af7d3 100644 --- a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java +++ b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java @@ -620,14 +620,13 @@ private ImportSummary importDataValueSet( ImportOptions options, JobConfiguration id, Callable createReader) { options = ObjectUtils.firstNonNull(options, ImportOptions.getDefaultImportOptions()); - BatchHandler dvBatch = - batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class); - BatchHandler dvaBatch = - batchHandlerFactory.createBatchHandler(DataValueAuditBatchHandler.class); - notifier.clear(id); - try (DataValueSetReader reader = createReader.call()) { + try (BatchHandler dvBatch = + batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class); + BatchHandler dvaBatch = + batchHandlerFactory.createBatchHandler(DataValueAuditBatchHandler.class); + DataValueSetReader reader = createReader.call()) { ImportSummary summary = importDataValueSet(options, id, reader, dvBatch, dvaBatch); dvBatch.flush(); @@ -640,8 +639,6 @@ private ImportSummary importDataValueSet( return summary; } catch (Exception ex) { - dvBatch.flush(); - dvaBatch.flush(); log.error(DebugUtils.getStackTrace(ex)); notifier.notify(id, ERROR, "Process failed: " + ex.getMessage(), true); return new ImportSummary(ImportStatus.ERROR, "The import process failed: " + ex.getMessage()); diff --git a/dhis-2/pom.xml b/dhis-2/pom.xml index 098d2f1aa577..aeb2794b8076 100644 --- a/dhis-2/pom.xml +++ b/dhis-2/pom.xml @@ -89,7 +89,7 @@ 2.1.9 - 1.4.1 + 1.4.2 2.0.0 0.10.1 From 192420c2b175f76c5df417e7c2404ff8fb76fdde Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Tue, 14 Nov 2023 16:35:55 +0100 Subject: [PATCH 02/14] Test with 1.4.3 version of quick --- dhis-2/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dhis-2/pom.xml b/dhis-2/pom.xml index 4a1259568ff4..1a6a39edee68 100644 --- a/dhis-2/pom.xml +++ b/dhis-2/pom.xml @@ -89,7 +89,7 @@ 2.1.9 - 1.4.2 + 1.4.3-SNAPSHOT 2.0.0 0.10.1 From 206921fa7285257e49bb96efb02a6465aa183625 Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Tue, 14 Nov 2023 17:43:14 +0100 Subject: [PATCH 03/14] Remove unneeded flush statement from test tear down --- .../CompleteDataSetRegistrationBatchHandlerTest.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java index 0a1c66996b50..cf2a368c39a5 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java @@ -92,11 +92,11 @@ class CompleteDataSetRegistrationBatchHandlerTest extends IntegrationTestBase { private CompleteDataSetRegistration regD; - private Date now = new Date(); + private final Date now = new Date(); - private String storedBy = "johndoe"; + private final String storedBy = "johndoe"; - private String lastUpdatedBy = "johndoe"; + private final String lastUpdatedBy = "johndoe"; // ------------------------------------------------------------------------- // Fixture @@ -165,9 +165,7 @@ public void setUpTest() { } @Override - public void tearDownTest() { - batchHandler.flush(); - } + public void tearDownTest() {} // ------------------------------------------------------------------------- // Tests From d615125b89244febdf89494f40129c5e699cda46 Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Tue, 14 Nov 2023 18:32:40 +0100 Subject: [PATCH 04/14] Rework test to deal with multi-theading --- .../DataValueBatchHandlerTest.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java index e76c66da4b6f..997a381ffe9b 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java @@ -72,7 +72,7 @@ class DataValueBatchHandlerTest extends IntegrationTestBase { @Autowired private CategoryService categoryService; - private BatchHandler batchHandler; + private DataElement dataElementA; @@ -105,7 +105,7 @@ class DataValueBatchHandlerTest extends IntegrationTestBase { // ------------------------------------------------------------------------- @Override public void setUpTest() { - batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class); + dataElementA = createDataElement('A'); dataElementService.addDataElement(dataElementA); categoryOptionComboA = categoryService.getDefaultCategoryOptionCombo(); @@ -142,19 +142,19 @@ public void setUpTest() { dataElementA, periodB, unitB, categoryOptionComboA, categoryOptionComboA, "15"); // with // 4th - batchHandler.init(); + } @Override - public void tearDownTest() { - batchHandler.flush(); - } + public void tearDownTest() {} // ------------------------------------------------------------------------- // Tests // ------------------------------------------------------------------------- @Test void testInsertObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); batchHandler.insertObject(dataValueA); DataValue dataValue = dataValueService.getDataValue( @@ -164,6 +164,8 @@ void testInsertObject() { @Test void testAddObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); batchHandler.addObject(dataValueA); batchHandler.addObject(dataValueB); batchHandler.addObject(dataValueC); @@ -185,6 +187,8 @@ void testAddObject() { @Test void testAddObjectDuplicates() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); batchHandler.addObject(dataValueA); batchHandler.addObject(dataValueB); batchHandler.addObject(dataValueC); @@ -208,6 +212,8 @@ void testAddObjectDuplicates() { @Test void testFindObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); dataValueService.addDataValue(dataValueA); dataValueService.addDataValue(dataValueC); DataValue retrievedDataValueA = batchHandler.findObject(dataValueA); @@ -224,6 +230,8 @@ void testFindObject() { @Test void testObjectExists() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); dataValueService.addDataValue(dataValueA); dataValueService.addDataValue(dataValueC); assertTrue(batchHandler.objectExists(dataValueA)); @@ -235,6 +243,8 @@ void testObjectExists() { @Test @Disabled("ERROR: cannot execute UPDATE in a read-only transaction") void testUpdateObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); dataValueService.addDataValue(dataValueA); dataValueA.setValue("20"); batchHandler.updateObject(dataValueA); @@ -247,6 +257,8 @@ void testUpdateObject() { @Test void testDeleteObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); dataValueService.addDataValue(dataValueA); dataValueService.addDataValue(dataValueC); assertTrue(batchHandler.objectExists(dataValueA)); From a8bc667ee1cc7a0f95d8deebe965f5a2827c4507 Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Tue, 14 Nov 2023 18:38:50 +0100 Subject: [PATCH 05/14] Rework test to deal with multi-theading --- .../DataValueAuditBatchHandlerTest.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueAuditBatchHandlerTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueAuditBatchHandlerTest.java index 3eff0bd09422..7b0d80f81096 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueAuditBatchHandlerTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueAuditBatchHandlerTest.java @@ -72,7 +72,7 @@ class DataValueAuditBatchHandlerTest extends SingleSetupIntegrationTestBase { @Autowired private CategoryService categoryService; - private BatchHandler batchHandler; + private DataElement dataElementA; @@ -107,7 +107,7 @@ class DataValueAuditBatchHandlerTest extends SingleSetupIntegrationTestBase { // ------------------------------------------------------------------------- @Override public void setUpTest() { - batchHandler = batchHandlerFactory.createBatchHandler(DataValueAuditBatchHandler.class); + dataElementA = createDataElement('A'); dataElementService.addDataElement(dataElementA); categoryOptionComboA = categoryService.getDefaultCategoryOptionCombo(); @@ -132,19 +132,19 @@ public void setUpTest() { auditB = new DataValueAudit(dataValueA, "12", storedBy, AuditType.UPDATE); auditC = new DataValueAudit(dataValueB, "21", storedBy, AuditType.UPDATE); auditD = new DataValueAudit(dataValueB, "22", storedBy, AuditType.UPDATE); - batchHandler.init(); + } @Override - public void tearDownTest() { - batchHandler.flush(); - } + public void tearDownTest() {} // ------------------------------------------------------------------------- // Tests // ------------------------------------------------------------------------- @Test void testAddObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueAuditBatchHandler.class).init(); batchHandler.addObject(auditA); batchHandler.addObject(auditB); batchHandler.addObject(auditC); @@ -161,6 +161,8 @@ void testAddObject() { /** DataValueAudit can never equal another. */ @Test void testObjectExists() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueAuditBatchHandler.class).init(); auditService.addDataValueAudit(auditA); auditService.addDataValueAudit(auditB); assertFalse(batchHandler.objectExists(auditA)); @@ -171,6 +173,8 @@ void testObjectExists() { @Test void testUpdateObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueAuditBatchHandler.class).init(); auditService.addDataValueAudit(auditA); auditA.setModifiedBy("bill"); batchHandler.updateObject(auditA); From e8b6232d9168c445935182bcfbf9c46e5032720e Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Tue, 14 Nov 2023 19:29:37 +0100 Subject: [PATCH 06/14] Linting --- .../dhis/jdbc/batchhandler/DataValueAuditBatchHandlerTest.java | 3 --- .../hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java | 2 -- 2 files changed, 5 deletions(-) diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueAuditBatchHandlerTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueAuditBatchHandlerTest.java index 7b0d80f81096..1e6ac8f700db 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueAuditBatchHandlerTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueAuditBatchHandlerTest.java @@ -72,8 +72,6 @@ class DataValueAuditBatchHandlerTest extends SingleSetupIntegrationTestBase { @Autowired private CategoryService categoryService; - - private DataElement dataElementA; private CategoryOptionCombo categoryOptionComboA; @@ -132,7 +130,6 @@ public void setUpTest() { auditB = new DataValueAudit(dataValueA, "12", storedBy, AuditType.UPDATE); auditC = new DataValueAudit(dataValueB, "21", storedBy, AuditType.UPDATE); auditD = new DataValueAudit(dataValueB, "22", storedBy, AuditType.UPDATE); - } @Override diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java index 997a381ffe9b..e04fdd38e7b8 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java @@ -72,8 +72,6 @@ class DataValueBatchHandlerTest extends IntegrationTestBase { @Autowired private CategoryService categoryService; - - private DataElement dataElementA; private CategoryOptionCombo categoryOptionComboA; From 6a7e57b9626a607c7415d333666d4a85b26db335 Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Wed, 15 Nov 2023 05:44:05 +0100 Subject: [PATCH 07/14] Add try-catch to Analytics table manager --- .../JdbcOwnershipAnalyticsTableManager.java | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java index be2333f65c91..941eca5e3106 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java @@ -178,30 +178,32 @@ private void populateTableInternal(AnalyticsTablePartition partition, String sql List columnNames = getDimensionColumns().stream().map(AnalyticsTableColumn::getName).collect(toList()); - MappingBatchHandler batchHandler = + try (MappingBatchHandler batchHandler = MappingBatchHandler.builder() .jdbcConfiguration(jdbcConfiguration) .tableName(partition.getTempTableName()) .columns(columnNames) - .build(); - - batchHandler.init(); - - JdbcOwnershipWriter writer = JdbcOwnershipWriter.getInstance(batchHandler); - AtomicInteger queryRowCount = new AtomicInteger(); - - jdbcTemplate.query( - sql, - resultSet -> { - writer.write(getRowMap(columnNames, resultSet)); - queryRowCount.getAndIncrement(); - }); - - log.info( - "OwnershipAnalytics query row count was {} for {}", - queryRowCount, - partition.getTempTableName()); - batchHandler.flush(); + .build()) { + batchHandler.init(); + + JdbcOwnershipWriter writer = JdbcOwnershipWriter.getInstance(batchHandler); + AtomicInteger queryRowCount = new AtomicInteger(); + + jdbcTemplate.query( + sql, + resultSet -> { + writer.write(getRowMap(columnNames, resultSet)); + queryRowCount.getAndIncrement(); + }); + + log.info( + "OwnershipAnalytics query row count was {} for {}", + queryRowCount, + partition.getTempTableName()); + batchHandler.flush(); + } catch (Exception e) { + log.error(e.getStackTrace().toString()); + } } private String getInputSql(Program program) { From 731ad8f6d630b897d7a5156be257af54b92ed960 Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Wed, 15 Nov 2023 06:26:44 +0100 Subject: [PATCH 08/14] Minor --- .../analytics/table/JdbcOwnershipAnalyticsTableManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java index 941eca5e3106..64661d1fdea5 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java @@ -202,7 +202,7 @@ private void populateTableInternal(AnalyticsTablePartition partition, String sql partition.getTempTableName()); batchHandler.flush(); } catch (Exception e) { - log.error(e.getStackTrace().toString()); + log.error(e.toString()); } } From f2414344abc3ca2cb9c34b1e4a18cd2c3bb99573 Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Wed, 15 Nov 2023 07:47:48 +0100 Subject: [PATCH 09/14] Bump quick to 1.4.3 --- dhis-2/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dhis-2/pom.xml b/dhis-2/pom.xml index 1a6a39edee68..0d191312558d 100644 --- a/dhis-2/pom.xml +++ b/dhis-2/pom.xml @@ -89,7 +89,7 @@ 2.1.9 - 1.4.3-SNAPSHOT + 1.4.3 2.0.0 0.10.1 From b4776c21f5cfbccf56fa22b9eb94b1fea8de15e7 Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Wed, 15 Nov 2023 10:33:02 +0100 Subject: [PATCH 10/14] Let exception flow to logs --- .../analytics/table/JdbcOwnershipAnalyticsTableManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java index 64661d1fdea5..81bbf9f56a29 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java @@ -201,8 +201,8 @@ private void populateTableInternal(AnalyticsTablePartition partition, String sql queryRowCount, partition.getTempTableName()); batchHandler.flush(); - } catch (Exception e) { - log.error(e.toString()); + } catch (Exception ex) { + log.error("Failed to alter table ownership: ", ex ); } } From d51d9fc607c0e72070f4bfbb0e9efca7c7b0a178 Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Wed, 15 Nov 2023 12:37:22 +0100 Subject: [PATCH 11/14] Linting --- .../analytics/table/JdbcOwnershipAnalyticsTableManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java index 81bbf9f56a29..20e8461c396a 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java @@ -183,6 +183,8 @@ private void populateTableInternal(AnalyticsTablePartition partition, String sql .jdbcConfiguration(jdbcConfiguration) .tableName(partition.getTempTableName()) .columns(columnNames) + .addObjectCount(0) + .closed(false) .build()) { batchHandler.init(); @@ -202,7 +204,7 @@ private void populateTableInternal(AnalyticsTablePartition partition, String sql partition.getTempTableName()); batchHandler.flush(); } catch (Exception ex) { - log.error("Failed to alter table ownership: ", ex ); + log.error("Failed to alter table ownership: ", ex); } } From 0e5251d15341e48b05116056625c70cd9e484ac0 Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Wed, 15 Nov 2023 12:37:50 +0100 Subject: [PATCH 12/14] Resolve issues with Lombok --- .../org/hisp/dhis/jdbc/batchhandler/MappingBatchHandler.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MappingBatchHandler.java b/dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MappingBatchHandler.java index a6e9799e8b8c..03a8f53aebdf 100644 --- a/dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MappingBatchHandler.java +++ b/dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MappingBatchHandler.java @@ -69,6 +69,10 @@ public class MappingBatchHandler extends AbstractBatchHandler uniqueColumns = emptyList(); + @Builder.Default private boolean closed = false; + + @Builder.Default private int addObjectCount = 0; + // ------------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------------- From 031d0f722c321c5a87446043ddcfb54479f57bf0 Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Wed, 15 Nov 2023 12:44:46 +0100 Subject: [PATCH 13/14] Revert "Resolve issues with Lombok" This reverts commit 0e5251d15341e48b05116056625c70cd9e484ac0. --- .../org/hisp/dhis/jdbc/batchhandler/MappingBatchHandler.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MappingBatchHandler.java b/dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MappingBatchHandler.java index 03a8f53aebdf..a6e9799e8b8c 100644 --- a/dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MappingBatchHandler.java +++ b/dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MappingBatchHandler.java @@ -69,10 +69,6 @@ public class MappingBatchHandler extends AbstractBatchHandler uniqueColumns = emptyList(); - @Builder.Default private boolean closed = false; - - @Builder.Default private int addObjectCount = 0; - // ------------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------------- From 3b790d5f0f85f0846e44c7a86b31ef30195775e4 Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Wed, 15 Nov 2023 12:50:45 +0100 Subject: [PATCH 14/14] Revert change to builder --- .../analytics/table/JdbcOwnershipAnalyticsTableManager.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java index 20e8461c396a..6c8c718a1ec4 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java @@ -183,8 +183,6 @@ private void populateTableInternal(AnalyticsTablePartition partition, String sql .jdbcConfiguration(jdbcConfiguration) .tableName(partition.getTempTableName()) .columns(columnNames) - .addObjectCount(0) - .closed(false) .build()) { batchHandler.init();