diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2021-03-22 14:19:44 +0100 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2021-03-22 14:19:44 +0100 |
commit | d8f449b620f572599dfa224a7536b8aa111f3b98 (patch) | |
tree | 8740397169cb5b047be14ceeaa45c01f54417af7 /clustercontroller-core | |
parent | 229e5e8adc0c6b20ae5b39a67a60f29ab0b05d7c (diff) |
Revert deferred ZK connectivity for now
Instead, we'll want to create a more generalized solution that considers
all sources of node information (Slobrok _and_ explicit health check RPCs)
before potentially publishing a state or processing tasks.
Diffstat (limited to 'clustercontroller-core')
3 files changed, 2 insertions, 21 deletions
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/FleetController.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/FleetController.java index a99561d7b1b..bdc8b8497aa 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/FleetController.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/FleetController.java @@ -600,10 +600,6 @@ public class FleetController implements NodeStateOrHostInfoChangeHandler, NodeAd public void tick() throws Exception { synchronized (monitor) { boolean didWork; - // We defer ZooKeeper connections until our local Slobrok mirror is ready. - // Otherwise we risk winning an election without having any clue about the state of - // the nodes in the cluster, causing us to spuriously publish cluster down-states. - database.setConnectionEstablishmentIsAllowed(nodeLookup.isReady()); didWork = database.doNextZooKeeperTask(databaseContext); didWork |= updateMasterElectionState(); didWork |= handleLeadershipEdgeTransitions(); diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/database/DatabaseHandler.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/database/DatabaseHandler.java index 54dc4cc2f31..d19425a7c95 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/database/DatabaseHandler.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/database/DatabaseHandler.java @@ -243,7 +243,7 @@ public class DatabaseHandler { didWork = true; } } - if (isDatabaseClosedSafe() && zooKeeperIsConfigured() && connectionEstablishmentIsAllowed) { + if (isDatabaseClosedSafe() && zooKeeperIsConfigured()) { long currentTime = timer.getCurrentTimeInMillis(); if (currentTime - lastZooKeeperConnectionAttempt < minimumWaitBetweenFailedConnectionAttempts) { return false; // Not time to attempt connection yet. @@ -268,10 +268,6 @@ public class DatabaseHandler { return didWork; } - public void setConnectionEstablishmentIsAllowed(boolean allowed) { - connectionEstablishmentIsAllowed = allowed; - } - private boolean zooKeeperIsConfigured() { // This should only ever be null during unit testing. return zooKeeperAddress != null; diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java index 7f664e65dc0..f6add77423a 100644 --- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java +++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java @@ -66,22 +66,11 @@ public class DatabaseHandlerTest { } DatabaseHandler createHandler() throws Exception { - var handler = new DatabaseHandler(mockDbFactory, mockTimer, databaseAddress, 0, monitor); - handler.setConnectionEstablishmentIsAllowed(true); - return handler; + return new DatabaseHandler(mockDbFactory, mockTimer, databaseAddress, 0, monitor); } } @Test - public void can_not_connect_to_database_if_connectivity_is_not_allowed() throws Exception { - Fixture f = new Fixture(); - DatabaseHandler handler = f.createHandler(); - handler.setConnectionEstablishmentIsAllowed(false); - handler.doNextZooKeeperTask(f.createMockContext()); - assertTrue(handler.isClosed()); // No connectivity allowed yet - } - - @Test public void can_store_latest_cluster_state_bundle() throws Exception { Fixture f = new Fixture(); DatabaseHandler handler = f.createHandler(); |