From 2b92169d9971f5bd2cdd826a806c625fe152db38 Mon Sep 17 00:00:00 2001 From: Troy Biesterfeld Date: Thu, 1 Jul 2021 12:35:27 -0500 Subject: [PATCH 1/2] Issue #2195 - Have client-driven reindex exit if no work to do Signed-off-by: Troy Biesterfeld --- .../fhir/bucket/reindex/ClientDrivenReindexOperation.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fhir-bucket/src/main/java/com/ibm/fhir/bucket/reindex/ClientDrivenReindexOperation.java b/fhir-bucket/src/main/java/com/ibm/fhir/bucket/reindex/ClientDrivenReindexOperation.java index 812aef63388..6e7a88b5c81 100644 --- a/fhir-bucket/src/main/java/com/ibm/fhir/bucket/reindex/ClientDrivenReindexOperation.java +++ b/fhir-bucket/src/main/java/com/ibm/fhir/bucket/reindex/ClientDrivenReindexOperation.java @@ -155,7 +155,11 @@ public void monitorLoop() { if (currentThreadCount == 0) { // Nothing currently running, so make one test call to verify things are working doneRetrieving = doneRetrieving || !callRetrieveIndex(); - if (!blockingQueue.isEmpty()) { + if (blockingQueue.isEmpty()) { + // Do not even start the worker threads if nothing to do + logger.info("Nothing to do, so do not even start the worker threads"); + this.running = false; + } else { // Should be OK now to fill the pool with workers logger.info("Index IDs available for processing - filling worker pool"); this.active = true; @@ -176,7 +180,7 @@ public void monitorLoop() { if (doneRetrieving) { if (blockingQueue.isEmpty()) { // Tell all the running threads they can stop now - logger.info("Nothing left to do, tell all the worker threads to exit"); + logger.info("Nothing left to do, so tell all the worker threads to exit"); this.running = false; } else { // Worker threads are still processing, so sleep for a bit before we check again From 8c334a964c52a437b582d2f3d787be40da6b8c1c Mon Sep 17 00:00:00 2001 From: Troy Biesterfeld Date: Thu, 1 Jul 2021 13:07:06 -0500 Subject: [PATCH 2/2] Issue #2195 - Fix testReindexFromTimestampDayTimeFormat testcase Signed-off-by: Troy Biesterfeld --- .../ibm/fhir/server/test/operation/ReindexOperationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fhir-server-test/src/test/java/com/ibm/fhir/server/test/operation/ReindexOperationTest.java b/fhir-server-test/src/test/java/com/ibm/fhir/server/test/operation/ReindexOperationTest.java index 6629d907c24..2df3f7c8847 100644 --- a/fhir-server-test/src/test/java/com/ibm/fhir/server/test/operation/ReindexOperationTest.java +++ b/fhir-server-test/src/test/java/com/ibm/fhir/server/test/operation/ReindexOperationTest.java @@ -224,7 +224,7 @@ public void testReindexFromTimestampDayTimeFormat() { + "-" + String.format("%02d", zdt.getMonthValue()) + "-" - + zdt.getDayOfMonth(); + + String.format("%02d", zdt.getDayOfMonth()); List parameters = new ArrayList<>(); parameters.add(Parameter.builder()