summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@yahoo-inc.com>2017-03-31 13:32:06 +0200
committerHarald Musum <musum@yahoo-inc.com>2017-03-31 13:32:06 +0200
commit955288be5fabcc374091d2a750111ba32a6c4a21 (patch)
tree75db189b73b49cc27b5cc33f717453a74b7b2c25 /configserver
parent08aad8ea0956de6fd4e3013d943af271ba31ff1d (diff)
Catch exception in RemoteSession instead
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/session/RemoteSession.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/RemoteSession.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/RemoteSession.java
index 9f733f7ea9a..ca4fa21f804 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/RemoteSession.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/RemoteSession.java
@@ -8,6 +8,7 @@ import com.yahoo.vespa.config.server.application.ApplicationSet;
import com.yahoo.vespa.config.server.modelfactory.ActivatedModelsBuilder;
import com.yahoo.vespa.config.server.tenant.Tenants;
import com.yahoo.vespa.curator.Curator;
+import org.apache.zookeeper.KeeperException;
import java.util.*;
import java.util.logging.Logger;
@@ -44,7 +45,7 @@ public class RemoteSession extends Session {
public void loadPrepared() {
Curator.CompletionWaiter waiter = zooKeeperClient.getPrepareWaiter();
ensureApplicationLoaded();
- waiter.notifyCompletion();
+ notifyCompletion(waiter);
}
private ApplicationSet loadApplication() {
@@ -74,7 +75,7 @@ public class RemoteSession extends Session {
log.log(LogLevel.DEBUG, logPre() + "Reloading config for " + app);
reloadHandler.reloadConfig(app);
log.log(LogLevel.DEBUG, logPre() + "Notifying " + waiter);
- waiter.notifyCompletion();
+ notifyCompletion(waiter);
log.log(LogLevel.DEBUG, logPre() + "Session activated: " + app);
}
@@ -90,8 +91,24 @@ public class RemoteSession extends Session {
public void confirmUpload() {
Curator.CompletionWaiter waiter = zooKeeperClient.getUploadWaiter();
log.log(LogLevel.DEBUG, "Notifying upload waiter for session " + getSessionId());
- waiter.notifyCompletion();
+ notifyCompletion(waiter);
log.log(LogLevel.DEBUG, "Done notifying for session " + getSessionId());
}
+ private void notifyCompletion(Curator.CompletionWaiter completionWaiter) {
+ try {
+ completionWaiter.notifyCompletion();
+ } catch (RuntimeException e) {
+ // Throw only if we get something else than NoNodeException -- NoNodeException might happen when
+ // the session is no longer in use (e.g. the app using this session has been deleted) and this method
+ // has not been called yet for the previous session operation
+ // on a minority of the config servers (see awaitInternal() method in this class)
+ if (e.getCause().getClass() != KeeperException.NoNodeException.class) {
+ throw e;
+ } else {
+ log.log(LogLevel.INFO, "Not able to notify completion for session: " + getSessionId() + ", node has been deleted");
+ }
+ }
+ }
+
}