diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2019-03-15 11:10:30 +0100 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2019-03-15 13:23:33 +0100 |
commit | 1c8c0c815f872347c2ed85e997fbede3e29f3686 (patch) | |
tree | 3be1d71d4f012bdf9a5e0d847c04e6142750f2de /clustercontroller-core/src/main | |
parent | 33b3bdca77a0141e4f20185024f8e772209ffbef (diff) |
Bind deferred activation decision to concrete bundle instance, not global config
Ensure that deferred activation flags are propagated during building and cloning.
Diffstat (limited to 'clustercontroller-core/src/main')
3 files changed, 5 insertions, 9 deletions
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundle.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundle.java index 35fe32f21c9..ca50701b763 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundle.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundle.java @@ -75,7 +75,7 @@ public class ClusterStateBundle { public ClusterStateBundle deriveAndBuild() { if ((stateDeriver == null || bucketSpaces == null || bucketSpaces.isEmpty()) && explicitDerivedStates == null) { - return ClusterStateBundle.ofBaselineOnly(baselineState); + return ClusterStateBundle.ofBaselineOnly(baselineState, deferredActivation); } Map<String, AnnotatedClusterState> derived; if (explicitDerivedStates != null) { @@ -148,7 +148,7 @@ public class ClusterStateBundle { Map<String, AnnotatedClusterState> clonedDerived = derivedBucketSpaceStates.entrySet().stream() .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().cloneWithClusterState( mapper.apply(e.getValue().getClusterState().clone())))); - return new ClusterStateBundle(clonedBaseline, clonedDerived); + return new ClusterStateBundle(clonedBaseline, clonedDerived, deferredActivation); } public ClusterStateBundle clonedWithVersionSet(int version) { 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 a653ace265b..69d1fb64f48 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 @@ -841,7 +841,7 @@ public class FleetController implements NodeStateOrHostInfoChangeHandler, NodeAd final ClusterStateBundle candidateBundle = ClusterStateBundle.builder(candidate) .bucketSpaces(configuredBucketSpaces) .stateDeriver(createBucketSpaceStateDeriver()) - .deferredActivation(true) + .deferredActivation(options.enableTwoPhaseClusterStateActivation) .deriveAndBuild(); stateVersionTracker.updateLatestCandidateStateBundle(candidateBundle); invokeCandidateStateListeners(candidateBundle); diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcaster.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcaster.java index e4a9f62b054..c4e72202893 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcaster.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcaster.java @@ -180,10 +180,6 @@ public class SystemStateBroadcaster { return (node.getClusterStateVersionActivationSent() == clusterStateBundle.getVersion()); } - private static boolean twoPhaseTransitionEnabled(FleetController controller) { - return controller.getOptions().enableTwoPhaseClusterStateActivation; - } - /** * Checks if all distributor nodes have ACKed (and activated) the most recent cluster state. * Iff this is the case, triggers handleAllDistributorsInSync() on the provided FleetController @@ -202,7 +198,7 @@ public class SystemStateBroadcaster { if (!anyDistributorsNeedStateBundle && (currentStateVersion > lastStateVersionBundleAcked)) { markCurrentClusterStateBundleAsReceivedByAllDistributors(); - if (twoPhaseTransitionEnabled(fleetController)) { + if (clusterStateBundle.deferredActivation()) { log.log(LogLevel.INFO, () -> String.format("All distributors have ACKed cluster state " + // TODO log level "version %d, sending activation", currentStateVersion)); } else { @@ -211,7 +207,7 @@ public class SystemStateBroadcaster { return; // Either converged (no two-phase) or activations must be sent before we can continue. } - if (anyDistributorsNeedStateBundle || !twoPhaseTransitionEnabled(fleetController)) { + if (anyDistributorsNeedStateBundle || !clusterStateBundle.deferredActivation()) { return; } |