aboutsummaryrefslogtreecommitdiffstats
path: root/clustercontroller-reindexer
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-01-15 10:37:28 +0100
committerJon Marius Venstad <venstad@gmail.com>2021-01-15 10:37:28 +0100
commit463e7b4bc20fc45392230c3292aa76d2f1d18ee4 (patch)
tree53f9c06cceaaf64e6af19a78f31a751f130e73eb /clustercontroller-reindexer
parent63734f83ebeb2ccdc025b06e4929dff7d44b1316 (diff)
Handle no result being set after abort and interrupt
Diffstat (limited to 'clustercontroller-reindexer')
-rw-r--r--clustercontroller-reindexer/src/main/java/ai/vespa/reindexing/Reindexer.java13
1 files changed, 8 insertions, 5 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 3b7c9160b53..37f9d830da8 100644
--- a/clustercontroller-reindexer/src/main/java/ai/vespa/reindexing/Reindexer.java
+++ b/clustercontroller-reindexer/src/main/java/ai/vespa/reindexing/Reindexer.java
@@ -3,12 +3,12 @@ package ai.vespa.reindexing;
import ai.vespa.reindexing.Reindexing.Status;
import ai.vespa.reindexing.ReindexingCurator.ReindexingLockException;
-import com.google.inject.Inject;
import com.yahoo.document.DocumentType;
import com.yahoo.document.select.parser.ParseException;
import com.yahoo.documentapi.DocumentAccess;
import com.yahoo.documentapi.ProgressToken;
import com.yahoo.documentapi.VisitorControlHandler;
+import com.yahoo.documentapi.VisitorControlHandler.CompletionCode;
import com.yahoo.documentapi.VisitorParameters;
import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol;
import com.yahoo.jdisc.Metric;
@@ -33,7 +33,7 @@ import static java.util.logging.Level.WARNING;
/**
* Progresses reindexing efforts by creating visitor sessions against its own content cluster,
- * which send documents straight to storage — via indexing if the documenet type has "index" mode.
+ * which send documents straight to storage — via indexing if the document type has "index" mode.
* The {@link #reindex} method blocks until shutdown is called, or until no more reindexing is left to do.
*
* @author jonmv
@@ -172,11 +172,14 @@ public class Reindexer {
Runnable sessionShutdown = visitorSessions.apply(parameters); // Also starts the visitor session.
log.log(FINE, () -> "Running reindexing of " + type);
- // Wait until done; or until termination is forced, in which we shut down the visitor session immediately.
+ // Wait until done; or until termination is forced, in which case we shut down the visitor session immediately.
phaser.arriveAndAwaitAdvance(); // Synchronize with visitor completion.
- sessionShutdown.run(); // Shutdown aborts the session unless already complete, then waits for it to terminate normally.
+ sessionShutdown.run(); // Shutdown aborts the session unless already complete, then waits for it to terminate normally.
+ // Only as a last resort will we be interrupted here, and the wait for outstanding replies terminate.
- switch (control.getResult().getCode()) {
+ CompletionCode result = control.getResult() != null ? control.getResult().getCode()
+ : CompletionCode.ABORTED;
+ switch (result) {
default:
log.log(WARNING, "Unexpected visitor result '" + control.getResult().getCode() + "'");
case FAILURE: // Intentional fallthrough — this is an error.