aboutsummaryrefslogtreecommitdiffstats
path: root/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahoo-inc.com>2017-05-09 12:33:44 +0200
committerGitHub <noreply@github.com>2017-05-09 12:33:44 +0200
commit795969419adfa7e34cda2ba8c959502f43324b09 (patch)
tree073374eeb22a0dba8b05db1b839ac6ea58552514 /documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java
parent4f36cf1ae65ceaac515c7a3828fef4bd093ddff7 (diff)
Treat document V1 API visiting timeouts with progress as successful (#2401)
Previously, using a visitor with a selection that did not match any buckets visited during the session's lifetime would trigger a timeout error to the client and abort the visiting. With this change, we special case timeouts if they have successfully visited at least 1 bucket and return a successful response for these. The client can then use the updated continuation token for its subsequent request and continue from where the timed out session left off. The timeout special cased handling is done _outside_ the session and control handler to avoid increasing session-internal complexity, and since not all visitor use cases want this behavior (e.g. streaming search).
Diffstat (limited to 'documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java')
-rwxr-xr-xdocumentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java
index 306103f2912..56edc7eb42a 100755
--- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java
+++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java
@@ -883,8 +883,7 @@ public class MessageBusVisitorSession implements VisitorSession {
if (isFatalError(reply)) {
if (params.skipBucketsOnFatalErrors()) {
- progress.getToken().addFailedBucket(bucket, subProgress, message);
- progress.getIterator().update(bucket, ProgressToken.FINISHED_BUCKET);
+ markBucketProgressAsFailed(bucket, subProgress, message);
} else {
reportVisitorError(message);
transitionTo(new StateDescription(State.FAILED, message));
@@ -903,6 +902,11 @@ public class MessageBusVisitorSession implements VisitorSession {
}
}
+ private void markBucketProgressAsFailed(BucketId bucket, BucketId subProgress, String message) {
+ progress.getToken().addFailedBucket(bucket, subProgress, message);
+ progress.getIterator().update(bucket, ProgressToken.FINISHED_BUCKET);
+ }
+
private boolean enoughHitsReceived() {
if (params.getMaxFirstPassHits() != -1
&& statistics.getDocumentsReturned() >= params.getMaxFirstPassHits())
@@ -1024,7 +1028,6 @@ public class MessageBusVisitorSession implements VisitorSession {
private void handleWrongDistributionReply(WrongDistributionReply reply) {
try {
- // Classnames clash with documentapi classes, so be explicit
ClusterState newState = new ClusterState(reply.getSystemState());
int stateBits = newState.getDistributionBitCount();
if (stateBits != progress.getIterator().getDistributionBitCount()) {
@@ -1123,7 +1126,7 @@ public class MessageBusVisitorSession implements VisitorSession {
synchronized (completionMonitor) {
// If we are destroying the session before it has completed (e.g. because
// waitUntilDone timed out or an interactive visiting was interrupted)
- // set us to aborted state so that we'll seize
+ // set us to aborted state so that we'll seize sending new visitors.
if (!done) {
transitionTo(new StateDescription(State.ABORTED, "Session explicitly destroyed before completion"));
}