diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2020-11-05 12:47:52 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2020-11-05 12:47:52 +0100 |
commit | 793896757cb554eb20ea32b3c24aced6515b5c14 (patch) | |
tree | 760cdf1ff69487be8c4ab30a98648499deaf1dbc /clustercontroller-reindexer | |
parent | 2679d5fbbe935580607791669844d65c11b568f6 (diff) |
Clear interrupt status when done with reindexing, before storing result
Diffstat (limited to 'clustercontroller-reindexer')
-rw-r--r-- | clustercontroller-reindexer/src/main/java/ai/vespa/reindexing/Reindexer.java | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/clustercontroller-reindexer/src/main/java/ai/vespa/reindexing/Reindexer.java b/clustercontroller-reindexer/src/main/java/ai/vespa/reindexing/Reindexer.java index 0386d34250c..3e66eea17cc 100644 --- a/clustercontroller-reindexer/src/main/java/ai/vespa/reindexing/Reindexer.java +++ b/clustercontroller-reindexer/src/main/java/ai/vespa/reindexing/Reindexer.java @@ -56,24 +56,21 @@ public class Reindexer { /** Starts and tracks reprocessing of ready document types until done, or interrupted. */ public void reindex(Lock __) { Reindexing reindexing = database.readReindexing(); - for (DocumentType type : ready.keySet()) { - if (Thread.currentThread().isInterrupted()) - break; - - // We consider only document types for which we have config. - // Get status for document type, or, if this is a new type, mark it as just completed. - Instant readyAt = ready.get(type); - if (readyAt.isAfter(clock.instant())) { - log.log(WARNING, "Received config for reindexing which is ready in the future " + - "(" + readyAt + " is after " + clock.instant() + ")"); - continue; + for (DocumentType type : ready.keySet()) { // We consider only document types for which we have config. + if (ready.get(type).isAfter(clock.instant())) { + log.log(WARNING, "Received config for reindexing which is ready in the future — will process later " + + "(" + ready.get(type) + " is after " + clock.instant() + ")"); } - - // If this is a new document type (or a new cluster), no reindexing is required. - Status status = reindexing.status().getOrDefault(type, Status.ready(clock.instant()) - .running() - .successful(clock.instant())); - reindexing = reindexing.with(type, progress(type, status)); + else { + // If this is a new document type (or a new cluster), no reindexing is required. + Status status = reindexing.status().getOrDefault(type, + Status.ready(clock.instant()) + .running() + .successful(clock.instant())); + reindexing = reindexing.with(type, progress(type, status)); + } + if (Thread.interrupted()) // Clear interruption status so blocking calls function normally again. + break; } database.writeReindexing(reindexing); } |