From 810da357155a349884b862de87e18de87ed54b35 Mon Sep 17 00:00:00 2001 From: Jon Marius Venstad Date: Fri, 14 Jan 2022 17:57:43 +0100 Subject: [PATCH] Revert "Jonmv/reapply zk changes 2" --- .../ClusterControllerCluster.java | 6 +- .../ApplicationContainerCluster.java | 5 +- .../provision/ModelProvisioningTest.java | 10 +- .../src/vespa/zookeeper-server.def | 3 - .../zookeeper-server-3.6.3/pom.xml | 9 +- .../ReconfigurableVespaZooKeeperServer.java | 8 +- .../zookeeper/VespaZooKeeperAdminImpl.java | 45 +-- .../vespa/zookeper/VespaZooKeeperTest.java | 258 ------------------ .../zookeeper-server-3.7.0/pom.xml | 9 +- .../ReconfigurableVespaZooKeeperServer.java | 8 +- .../zookeeper/VespaZooKeeperAdminImpl.java | 47 ++-- .../vespa/zookeper/VespaZooKeeperTest.java | 258 ------------------ .../yahoo/vespa/zookeeper/Configurator.java | 11 +- .../yahoo/vespa/zookeeper/Reconfigurer.java | 66 +++-- .../vespa/zookeeper/VespaZooKeeperAdmin.java | 2 +- .../vespa/zookeeper/ReconfigurerTest.java | 69 ++--- 16 files changed, 151 insertions(+), 663 deletions(-) delete mode 100644 zookeeper-server/zookeeper-server-3.6.3/src/test/java/com/yahoo/vespa/zookeper/VespaZooKeeperTest.java delete mode 100644 zookeeper-server/zookeeper-server-3.7.0/src/test/java/com/yahoo/vespa/zookeper/VespaZooKeeperTest.java diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerCluster.java index 0b99496a9b42..6e6f027b520a 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerCluster.java @@ -50,12 +50,14 @@ public ClusterControllerCluster(AbstractConfigProducer parent, String subId, public void getConfig(ZookeeperServerConfig.Builder builder) { builder.clientPort(ZK_CLIENT_PORT); builder.juteMaxBuffer(1024 * 1024); // 1 Mb should be more than enough for cluster controller + boolean oldQuorumExists = containerCluster.getContainers().stream() // More than half the previous hosts must be present in the new config for quorum to persist. + .filter(container -> previousHosts.contains(container.getHostName())) // Set intersection is symmetric. + .count() > previousHosts.size() / 2; for (ClusterControllerContainer container : containerCluster.getContainers()) { ZookeeperServerConfig.Server.Builder serverBuilder = new ZookeeperServerConfig.Server.Builder(); serverBuilder.hostname(container.getHostName()); serverBuilder.id(container.index()); - serverBuilder.joining( ! previousHosts.isEmpty() && ! previousHosts.contains(container.getHostName())); - serverBuilder.retired(container.isRetired()); + serverBuilder.joining(oldQuorumExists && ! previousHosts.contains(container.getHostName())); builder.server(serverBuilder); } } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java index 438e143bdfd9..c4d420f2d449 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java @@ -309,9 +309,8 @@ public void getConfig(ZookeeperServerConfig.Builder builder) { ZookeeperServerConfig.Server.Builder serverBuilder = new ZookeeperServerConfig.Server.Builder(); serverBuilder.hostname(container.getHostName()) .id(container.index()) - .joining( ! previousHosts.isEmpty() && - ! previousHosts.contains(container.getHostName())) - .retired(container.isRetired()); + .joining(!previousHosts.isEmpty() && + !previousHosts.contains(container.getHostName())); builder.server(serverBuilder); builder.dynamicReconfiguration(true); } diff --git a/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java b/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java index ba70b7493a2b..10f883bdc75a 100644 --- a/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java +++ b/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java @@ -2054,7 +2054,7 @@ public void containerWithZooKeeperJoiningServers() { assertTrue("Initial servers are not joining", config.build().server().stream().noneMatch(ZookeeperServerConfig.Server::joining)); } { - VespaModel nextModel = tester.createModel(Zone.defaultZone(), servicesXml.apply(3), true, false, false, 0, Optional.of(model), new DeployState.Builder(), "node-1-3-10-04", "node-1-3-10-03"); + VespaModel nextModel = tester.createModel(Zone.defaultZone(), servicesXml.apply(5), true, false, false, 0, Optional.of(model), new DeployState.Builder()); ApplicationContainerCluster cluster = nextModel.getContainerClusters().get("zk"); ZookeeperServerConfig.Builder config = new ZookeeperServerConfig.Builder(); cluster.getContainers().forEach(c -> c.getConfig(config)); @@ -2067,14 +2067,6 @@ public void containerWithZooKeeperJoiningServers() { 4, true), config.build().server().stream().collect(Collectors.toMap(ZookeeperServerConfig.Server::id, ZookeeperServerConfig.Server::joining))); - assertEquals("Retired nodes are retired", - Map.of(0, false, - 1, true, - 2, true, - 3, false, - 4, false), - config.build().server().stream().collect(Collectors.toMap(ZookeeperServerConfig.Server::id, - ZookeeperServerConfig.Server::retired))); } } diff --git a/configdefinitions/src/vespa/zookeeper-server.def b/configdefinitions/src/vespa/zookeeper-server.def index d80ccc4d042b..04632ffd35f9 100644 --- a/configdefinitions/src/vespa/zookeeper-server.def +++ b/configdefinitions/src/vespa/zookeeper-server.def @@ -32,13 +32,10 @@ juteMaxBuffer int default=52428800 myid int restart server[].id int server[].hostname string -server[].clientPort int default=2181 server[].quorumPort int default=2182 server[].electionPort int default=2183 # Whether this server is joining an existing cluster server[].joining bool default=false -# Whether this server is retired, and about to be removed -server[].retired bool default=false # Needed when upgrading from ZooKeeper 3.4 to 3.5, see https://issues.apache.org/jira/browse/ZOOKEEPER-3056, # and in general where there is a zookeeper ensemble running that has had few transactions. diff --git a/zookeeper-server/zookeeper-server-3.6.3/pom.xml b/zookeeper-server/zookeeper-server-3.6.3/pom.xml index a8ad183de4e7..f7e6f512f7c9 100644 --- a/zookeeper-server/zookeeper-server-3.6.3/pom.xml +++ b/zookeeper-server/zookeeper-server-3.6.3/pom.xml @@ -11,9 +11,6 @@ zookeeper-server-3.6.3 container-plugin 7-SNAPSHOT - - 3.6.3 - com.yahoo.vespa @@ -35,7 +32,7 @@ org.apache.zookeeper zookeeper - ${zookeeper.version} + 3.6.3