aboutsummaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2021-07-08 14:58:31 +0200
committerHarald Musum <musum@verizonmedia.com>2021-07-08 14:58:31 +0200
commitc87ccbdf27353c44bf80c9a4036fef1281b129f5 (patch)
tree245a785cb6ea356d9a03c29b3031bf23ddf768cd /configserver
parent92b76a15b7d00ff0c7158225398cd7dc9e40cf73 (diff)
Avoid checking and creating node
If node is created between exists() and create() this will fail, just catch exception if node already exists and ignore it
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ConfigCurator.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ConfigCurator.java b/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ConfigCurator.java
index 5bfa06a29dd..b13750f93d4 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ConfigCurator.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ConfigCurator.java
@@ -5,6 +5,7 @@ import com.google.inject.Inject;
import com.yahoo.cloud.config.ZookeeperServerConfig;
import com.yahoo.text.Utf8;
import com.yahoo.vespa.curator.Curator;
+import org.apache.zookeeper.KeeperException;
import java.util.List;
import java.util.logging.Level;
@@ -88,7 +89,10 @@ public class ConfigCurator {
if (exists(path)) return;
curator.framework().create().creatingParentsIfNeeded().forPath(path);
}
- catch (Exception e) {
+ catch (KeeperException.NodeExistsException e) {
+ // Ignore, path already exists
+ }
+ catch(Exception e){
throw new RuntimeException("Exception creating path " + path + " in ZooKeeper", e);
}
}