aboutsummaryrefslogtreecommitdiffstats
path: root/clustercontroller-apps
diff options
context:
space:
mode:
authorArnstein Ressem <aressem@gmail.com>2020-12-09 10:47:09 +0100
committerGitHub <noreply@github.com>2020-12-09 10:47:09 +0100
commited6594bd59d40e4c0bf41c818f99fcdb8461d8fd (patch)
tree8653395e962b73c35e71ba90004f944e806f36e1 /clustercontroller-apps
parentf5ede0bc8c6caf1e8891290298cc65b9b759f172 (diff)
Revert "Remove code that nobody understands the need for"
Diffstat (limited to 'clustercontroller-apps')
-rw-r--r--clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterController.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterController.java b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterController.java
index 75ea7000e4c..b04f04abfb6 100644
--- a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterController.java
+++ b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterController.java
@@ -1,4 +1,4 @@
-// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.apps.clustercontroller;
import com.google.inject.Inject;
@@ -10,6 +10,7 @@ import com.yahoo.vespa.clustercontroller.core.FleetControllerOptions;
import com.yahoo.vespa.clustercontroller.core.RemoteClusterControllerTaskScheduler;
import com.yahoo.vespa.clustercontroller.core.restapiv2.ClusterControllerStateRestAPI;
import com.yahoo.vespa.clustercontroller.core.status.StatusHandler;
+import com.yahoo.vespa.curator.Curator;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -33,7 +34,6 @@ public class ClusterController extends AbstractComponent
* to ensure that zookeeper has started before we start polling it.
*/
@Inject
- @SuppressWarnings("unused")
public ClusterController(ZooKeeperProvider zooKeeperProvider) {
this();
}
@@ -45,8 +45,17 @@ public class ClusterController extends AbstractComponent
public void setOptions(String clusterName, FleetControllerOptions options, Metric metricImpl) throws Exception {
metricWrapper.updateMetricImplementation(metricImpl);
+ if (options.zooKeeperServerAddress != null && !"".equals(options.zooKeeperServerAddress)) {
+ // Wipe this path ... it's unclear why
+ String path = "/" + options.clusterName + options.fleetControllerIndex;
+ Curator curator = Curator.create(options.zooKeeperServerAddress);
+ if (curator.framework().checkExists().forPath(path) != null)
+ curator.framework().delete().deletingChildrenIfNeeded().forPath(path);
+ curator.framework().create().creatingParentsIfNeeded().forPath(path);
+ }
synchronized (controllers) {
FleetController controller = controllers.get(clusterName);
+
if (controller == null) {
StatusHandler.ContainerStatusPageServer statusPageServer = new StatusHandler.ContainerStatusPageServer();
controller = FleetController.create(options, statusPageServer, metricWrapper);