diff options
author | Harald Musum <musum@yahooinc.com> | 2023-06-05 17:11:55 +0200 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2023-06-05 17:11:55 +0200 |
commit | aa21f8b53457c94144a969fb60ce1075b80fcecb (patch) | |
tree | 701e39c9ef8324346fd62be1cc5d9c08dbfe64e7 /clustercontroller-core/src/main/java | |
parent | abf620e10fb21a1295a2f6ca69b4c592d824a385 (diff) |
Remove support for RPC method getMaster, only used in tests
Diffstat (limited to 'clustercontroller-core/src/main/java')
2 files changed, 1 insertions, 41 deletions
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/MasterElectionHandler.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/MasterElectionHandler.java index 01240da2fc8..68b132e34b4 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/MasterElectionHandler.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/MasterElectionHandler.java @@ -77,30 +77,6 @@ public class MasterElectionHandler implements MasterInterface { return masterCandidate; } - public String getMasterReason() { - if (masterCandidate == null) { - return "There is currently no master candidate."; - } - if (tooFewFollowersToHaveAMaster()) { - return "More than half of the nodes must agree for there to be a master. Only " + followers + " of " - + totalCount + " nodes agree on current master candidate (" + masterCandidate + ")."; - } - // If all are following master candidate, it is master if it exists. - if (followers == totalCount) { - return "All " + totalCount + " nodes agree that " + masterCandidate + " is current master."; - } - - // If not all are following we only accept master candidate if old master - // disappeared sufficient time ago - if (masterGoneFromZooKeeperTime + masterZooKeeperCooldownPeriod > timer.getCurrentTimeInMillis()) { - return followers + " of " + totalCount + " nodes agree " + masterCandidate + " should be master, " - + "but old master cooldown period of " + masterZooKeeperCooldownPeriod + " ms has not passed yet. " - + "To ensure it has got time to realize it is no longer master before we elect a new one, " - + "currently there is no master."; - } - return followers + " of " + totalCount + " nodes agree " + masterCandidate + " is master."; - } - private boolean tooFewFollowersToHaveAMaster() { return 2 * followers <= totalCount; } diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/rpc/RpcServer.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/rpc/RpcServer.java index f1ff52816a3..fa8550efb93 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/rpc/RpcServer.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/rpc/RpcServer.java @@ -3,7 +3,6 @@ package com.yahoo.vespa.clustercontroller.core.rpc; import com.yahoo.jrt.Acceptor; import com.yahoo.jrt.ErrorCode; -import com.yahoo.jrt.Int32Value; import com.yahoo.jrt.ListenFailedException; import com.yahoo.jrt.Method; import com.yahoo.jrt.Request; @@ -121,13 +120,7 @@ public class RpcServer { } public void addMethods() { - Method m = new Method("getMaster", "", "is", this::queueRpcRequest); - m.methodDesc("Get index of current fleetcontroller master"); - m.returnDesc(0, "masterindex", "The index of the current master according to this node, or -1 if there is none."); - m.returnDesc(1, "description", "A textual field, used for additional information, such as why there is no master."); - supervisor.addMethod(m); - - m = new Method("getSystemState", "", "ss", this::queueRpcRequest); + Method m = new Method("getSystemState", "", "ss", this::queueRpcRequest); m.methodDesc("Get nodeState of all nodes and the system itself"); m.returnDesc(0, "systemstate", "nodeState string of system"); m.returnDesc(1, "nodestate", "nodeState-string for distributor and storage-nodes"); @@ -175,15 +168,6 @@ public class RpcServer { handledAnyRequests = true; } try{ - if (req.methodName().equals("getMaster")) { - log.log(Level.FINE, "Resolving RPC getMaster request"); - Integer master = masterHandler.getMaster(); - String masterReason = masterHandler.getMasterReason(); - req.returnValues().add(new Int32Value(master == null ? -1 : master)); - req.returnValues().add(new StringValue(masterReason == null ? "No reason given" : masterReason)); - req.returnRequest(); - continue; - } if (!masterHandler.isMaster()) { throw new IllegalStateException("Refusing to answer RPC calls as we are not the master fleetcontroller."); } |