Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced "master" terminology in Log message #2575

Merged
merged 3 commits into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public void testFailsOnUnknownNode() throws Exception {
assertThat(e.getResponse().getStatusLine().getStatusCode(), is(400));
assertThat(
e.getMessage(),
Matchers.containsString("add voting config exclusions request for [invalid] matched no master-eligible nodes")
Matchers.containsString("add voting config exclusions request for [invalid] matched no cluster-manager-eligible nodes")
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public void test3MasterNodes2Failed() throws Exception {
internalCluster().setBootstrapMasterNodeIndex(2);
List<String> masterNodes = new ArrayList<>();

logger.info("--> start 1st master-eligible node");
logger.info("--> start 1st cluster-manager-eligible node");
masterNodes.add(
internalCluster().startMasterOnlyNode(
Settings.builder().put(DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.getKey(), "0s").build()
Expand All @@ -299,7 +299,7 @@ public void test3MasterNodes2Failed() throws Exception {
Settings.builder().put(DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.getKey(), "0s").build()
); // node ordinal 1

logger.info("--> start 2nd and 3rd master-eligible nodes and bootstrap");
logger.info("--> start 2nd and 3rd cluster-manager-eligible nodes and bootstrap");
masterNodes.addAll(internalCluster().startMasterOnlyNodes(2)); // node ordinals 2 and 3

logger.info("--> wait for all nodes to join the cluster");
Expand Down Expand Up @@ -335,19 +335,19 @@ public void test3MasterNodes2Failed() throws Exception {
assertTrue(state.blocks().hasGlobalBlockWithId(NoMasterBlockService.NO_MASTER_BLOCK_ID));
});

logger.info("--> try to unsafely bootstrap 1st master-eligible node, while node lock is held");
logger.info("--> try to unsafely bootstrap 1st cluster-manager-eligible node, while node lock is held");
Environment environmentMaster1 = TestEnvironment.newEnvironment(
Settings.builder().put(internalCluster().getDefaultSettings()).put(master1DataPathSettings).build()
);
expectThrows(() -> unsafeBootstrap(environmentMaster1), UnsafeBootstrapMasterCommand.FAILED_TO_OBTAIN_NODE_LOCK_MSG);

logger.info("--> stop 1st master-eligible node and data-only node");
logger.info("--> stop 1st cluster-manager-eligible node and data-only node");
NodeEnvironment nodeEnvironment = internalCluster().getMasterNodeInstance(NodeEnvironment.class);
internalCluster().stopRandomNode(InternalTestCluster.nameFilter(masterNodes.get(0)));
assertBusy(() -> internalCluster().getInstance(GatewayMetaState.class, dataNode).allPendingAsyncStatesWritten());
internalCluster().stopRandomDataNode();

logger.info("--> unsafely-bootstrap 1st master-eligible node");
logger.info("--> unsafely-bootstrap 1st cluster-manager-eligible node");
MockTerminal terminal = unsafeBootstrap(environmentMaster1, false, true);
Metadata metadata = OpenSearchNodeCommand.createPersistedClusterStateService(Settings.EMPTY, nodeEnvironment.nodeDataPaths())
.loadBestOnDiskState().metadata;
Expand All @@ -363,7 +363,7 @@ public void test3MasterNodes2Failed() throws Exception {
)
);

logger.info("--> start 1st master-eligible node");
logger.info("--> start 1st cluster-manager-eligible node");
String masterNode2 = internalCluster().startMasterOnlyNode(master1DataPathSettings);

logger.info("--> detach-cluster on data-only node");
Expand Down Expand Up @@ -399,7 +399,7 @@ public void test3MasterNodes2Failed() throws Exception {
IndexMetadata indexMetadata = clusterService().state().metadata().index("test");
assertThat(indexMetadata.getSettings().get(IndexMetadata.SETTING_HISTORY_UUID), notNullValue());

logger.info("--> detach-cluster on 2nd and 3rd master-eligible nodes");
logger.info("--> detach-cluster on 2nd and 3rd cluster-manager-eligible nodes");
Environment environmentMaster2 = TestEnvironment.newEnvironment(
Settings.builder().put(internalCluster().getDefaultSettings()).put(master2DataPathSettings).build()
);
Expand All @@ -409,7 +409,7 @@ public void test3MasterNodes2Failed() throws Exception {
);
detachCluster(environmentMaster3, false);

logger.info("--> start 2nd and 3rd master-eligible nodes and ensure 4 nodes stable cluster");
logger.info("--> start 2nd and 3rd cluster-manager-eligible nodes and ensure 4 nodes stable cluster");
bootstrappedNodes.add(internalCluster().startMasterOnlyNode(master2DataPathSettings));
bootstrappedNodes.add(internalCluster().startMasterOnlyNode(master3DataPathSettings));
ensureStableCluster(4);
Expand All @@ -422,7 +422,7 @@ public void testAllMasterEligibleNodesFailedDanglingIndexImport() throws Excepti

Settings settings = Settings.builder().put(AUTO_IMPORT_DANGLING_INDICES_SETTING.getKey(), true).build();

logger.info("--> start mixed data and master-eligible node and bootstrap cluster");
logger.info("--> start mixed data and cluster-manager-eligible node and bootstrap cluster");
String masterNode = internalCluster().startNode(settings); // node ordinal 0

logger.info("--> start data-only node and ensure 2 nodes stable cluster");
Expand Down Expand Up @@ -457,7 +457,7 @@ public void testAllMasterEligibleNodesFailedDanglingIndexImport() throws Excepti
);
detachCluster(environment, false);

logger.info("--> stop master-eligible node, clear its data and start it again - new cluster should form");
logger.info("--> stop cluster-manager-eligible node, clear its data and start it again - new cluster should form");
internalCluster().restartNode(masterNode, new InternalTestCluster.RestartCallback() {
@Override
public boolean clearData(String nodeName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ public void testRegistrationFailure() {
logger.info("--> start first node");
internalCluster().startNode();
logger.info("--> start second node");
// Make sure the first node is elected as master
// Make sure the first node is elected as cluster-manager
internalCluster().startNode(nonMasterNode());
// Register mock repositories
for (int i = 0; i < 5; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ Set<VotingConfigExclusion> resolveVotingConfigExclusions(ClusterState currentSta

if (newVotingConfigExclusions.isEmpty()) {
throw new IllegalArgumentException(
"add voting config exclusions request for " + Arrays.asList(nodeDescriptions) + " matched no master-eligible nodes"
"add voting config exclusions request for "
+ Arrays.asList(nodeDescriptions)
+ " matched no cluster-manager-eligible nodes"
);
}
} else if (nodeIds.length >= 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ void setUpdateFrequency(TimeValue updateFrequency) {
@Override
public void clusterChanged(ClusterChangedEvent event) {
if (event.localNodeMaster() && refreshAndRescheduleRunnable.get() == null) {
logger.trace("elected as master, scheduling cluster info update tasks");
executeRefresh(event.state(), "became master");
logger.trace("elected as cluster-manager, scheduling cluster info update tasks");
executeRefresh(event.state(), "became cluster-manager");

final RefreshAndRescheduleRunnable newRunnable = new RefreshAndRescheduleRunnable();
refreshAndRescheduleRunnable.set(newRunnable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public ClusterBootstrapService(
+ DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey()
+ "] set to ["
+ DiscoveryModule.SINGLE_NODE_DISCOVERY_TYPE
+ "] must be master-eligible"
+ "] must be cluster-manager-eligible"
);
}
bootstrapRequirements = Collections.singleton(Node.NODE_NAME_SETTING.get(settings));
Expand Down Expand Up @@ -219,7 +219,7 @@ void scheduleUnconfiguredBootstrap() {

logger.info(
"no discovery configuration found, will perform best-effort cluster bootstrapping after [{}] "
+ "unless existing master is discovered",
+ "unless existing cluster-manager is discovered",
unconfiguredBootstrapTimeout
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ String getDescription() {
);

if (clusterState.nodes().getLocalNode().isMasterNode() == false) {
return String.format(Locale.ROOT, "master not discovered yet: %s", discoveryStateIgnoringQuorum);
return String.format(Locale.ROOT, "cluster-manager not discovered yet: %s", discoveryStateIgnoringQuorum);
}

if (clusterState.getLastAcceptedConfiguration().isEmpty()) {
Expand All @@ -203,14 +203,14 @@ String getDescription() {
} else {
bootstrappingDescription = String.format(
Locale.ROOT,
"this node must discover master-eligible nodes %s to bootstrap a cluster",
"this node must discover cluster-manager-eligible nodes %s to bootstrap a cluster",
INITIAL_CLUSTER_MANAGER_NODES_SETTING.get(settings)
);
}

return String.format(
Locale.ROOT,
"master not discovered yet, this node has not previously joined a bootstrapped cluster, and %s: %s",
"cluster-manager not discovered yet, this node has not previously joined a bootstrapped cluster, and %s: %s",
bootstrappingDescription,
discoveryStateIgnoringQuorum
);
Expand All @@ -221,7 +221,7 @@ String getDescription() {
if (clusterState.getLastCommittedConfiguration().equals(VotingConfiguration.MUST_JOIN_ELECTED_MASTER)) {
return String.format(
Locale.ROOT,
"master not discovered yet and this node was detached from its previous cluster, have discovered %s; %s",
"cluster-manager not discovered yet and this node was detached from its previous cluster, have discovered %s; %s",
foundPeers,
discoveryWillContinueDescription
);
Expand Down Expand Up @@ -250,7 +250,7 @@ String getDescription() {

return String.format(
Locale.ROOT,
"master not discovered or elected yet, an election requires %s, have discovered %s which %s; %s",
"cluster-manager not discovered or elected yet, an election requires %s, have discovered %s which %s; %s",
quorumDescription,
foundPeers,
isQuorumOrNot,
Expand All @@ -269,8 +269,8 @@ private String describeQuorum(VotingConfiguration votingConfiguration) {

if (nodeIds.size() == 1) {
if (nodeIds.contains(GatewayMetaState.STALE_STATE_CONFIG_NODE_ID)) {
return "one or more nodes that have already participated as master-eligible nodes in the cluster but this node was "
+ "not master-eligible the last time it joined the cluster";
return "one or more nodes that have already participated as cluster-manager-eligible nodes in the cluster but this node was "
+ "not cluster-manager-eligible the last time it joined the cluster";
} else {
return "a node with id " + realNodeIds;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ private void startElection() {
private void abdicateTo(DiscoveryNode newMaster) {
assert Thread.holdsLock(mutex);
assert mode == Mode.LEADER : "expected to be leader on abdication but was " + mode;
assert newMaster.isMasterNode() : "should only abdicate to master-eligible node but was " + newMaster;
assert newMaster.isMasterNode() : "should only abdicate to cluster-manager-eligible node but was " + newMaster;
final StartJoinRequest startJoinRequest = new StartJoinRequest(newMaster, Math.max(getCurrentTerm(), maxTermSeen) + 1);
logger.info("abdicating to {} with term {}", newMaster, startJoinRequest.getTerm());
getLastAcceptedState().nodes().mastersFirstStream().forEach(node -> {
Expand Down Expand Up @@ -563,7 +563,7 @@ private Join joinLeaderInTerm(StartJoinRequest startJoinRequest) {

private void handleJoinRequest(JoinRequest joinRequest, JoinHelper.JoinCallback joinCallback) {
assert Thread.holdsLock(mutex) == false;
assert getLocalNode().isMasterNode() : getLocalNode() + " received a join but is not master-eligible";
assert getLocalNode().isMasterNode() : getLocalNode() + " received a join but is not cluster-manager-eligible";
logger.trace("handleJoinRequest: as {}, handling {}", mode, joinRequest);

if (singleNodeDiscovery && joinRequest.getSourceNode().equals(getLocalNode()) == false) {
Expand Down Expand Up @@ -683,7 +683,7 @@ void becomeCandidate(String method) {
void becomeLeader(String method) {
assert Thread.holdsLock(mutex) : "Coordinator mutex not held";
assert mode == Mode.CANDIDATE : "expected candidate but was " + mode;
assert getLocalNode().isMasterNode() : getLocalNode() + " became a leader but is not master-eligible";
assert getLocalNode().isMasterNode() : getLocalNode() + " became a leader but is not cluster-manager-eligible";

logger.debug(
"{}: coordinator becoming LEADER in term {} (was {}, lastKnownLeader was [{}])",
Expand All @@ -709,7 +709,7 @@ void becomeLeader(String method) {

void becomeFollower(String method, DiscoveryNode leaderNode) {
assert Thread.holdsLock(mutex) : "Coordinator mutex not held";
assert leaderNode.isMasterNode() : leaderNode + " became a leader but is not master-eligible";
assert leaderNode.isMasterNode() : leaderNode + " became a leader but is not cluster-manager-eligible";
assert mode != Mode.LEADER : "do not switch to follower from leader (should be candidate first)";

if (mode == Mode.FOLLOWER && Optional.of(leaderNode).equals(lastKnownLeader)) {
Expand Down Expand Up @@ -751,11 +751,11 @@ void becomeFollower(String method, DiscoveryNode leaderNode) {
}

private void cleanMasterService() {
masterService.submitStateUpdateTask("clean-up after stepping down as master", new LocalClusterUpdateTask() {
masterService.submitStateUpdateTask("clean-up after stepping down as cluster-manager", new LocalClusterUpdateTask() {
@Override
public void onFailure(String source, Exception e) {
// ignore
logger.trace("failed to clean-up after stepping down as master", e);
logger.trace("failed to clean-up after stepping down as cluster-manager", e);
}

@Override
Expand Down Expand Up @@ -987,9 +987,9 @@ public boolean setInitialConfiguration(final VotingConfiguration votingConfigura
}

if (getLocalNode().isMasterNode() == false) {
logger.debug("skip setting initial configuration as local node is not a master-eligible node");
logger.debug("skip setting initial configuration as local node is not a cluster-manager-eligible node");
throw new CoordinationStateRejectedException(
"this node is not master-eligible, but cluster bootstrapping can only happen on a master-eligible node"
"this node is not cluster-manager-eligible, but cluster bootstrapping can only happen on a cluster-manager-eligible node"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public class DetachClusterCommand extends OpenSearchNodeCommand {
static final String CONFIRMATION_MSG = DELIMITER
+ "\n"
+ "You should only run this tool if you have permanently lost all of the\n"
+ "master-eligible nodes in this cluster and you cannot restore the cluster\n"
+ "cluster-manager-eligible nodes in this cluster and you cannot restore the cluster\n"
+ "from a snapshot, or you have already unsafely bootstrapped a new cluster\n"
+ "by running `opensearch-node unsafe-bootstrap` on a master-eligible\n"
+ "by running `opensearch-node unsafe-bootstrap` on a cluster-manager-eligible\n"
+ "node that belonged to the same cluster as this node. This tool can cause\n"
+ "arbitrary data loss and its use should be your last resort.\n"
+ "\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public void close(Mode newMode) {
pendingAsTasks.put(task, new JoinTaskListener(task, value));
});

final String stateUpdateSource = "elected-as-master ([" + pendingAsTasks.size() + "] nodes joined)";
final String stateUpdateSource = "elected-as-cluster-manager ([" + pendingAsTasks.size() + "] nodes joined)";

pendingAsTasks.put(JoinTaskExecutor.newBecomeMasterTask(), (source, e) -> {});
pendingAsTasks.put(JoinTaskExecutor.newFinishElectionTask(), (source, e) -> {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ public class UnsafeBootstrapMasterCommand extends OpenSearchNodeCommand {
static final String CONFIRMATION_MSG = DELIMITER
+ "\n"
+ "You should only run this tool if you have permanently lost half or more\n"
+ "of the master-eligible nodes in this cluster, and you cannot restore the\n"
+ "of the cluster-manager-eligible nodes in this cluster, and you cannot restore the\n"
+ "cluster from a snapshot. This tool can cause arbitrary data loss and its\n"
+ "use should be your last resort. If you have multiple surviving master\n"
+ "use should be your last resort. If you have multiple surviving cluster-manager\n"
+ "eligible nodes, you should run this tool on the node with the highest\n"
+ "cluster state (term, version) pair.\n"
+ "\n"
+ "Do you want to proceed?\n";

static final String NOT_MASTER_NODE_MSG = "unsafe-bootstrap tool can only be run on master eligible node";
static final String NOT_MASTER_NODE_MSG = "unsafe-bootstrap tool can only be run on cluster-manager eligible node";

static final String EMPTY_LAST_COMMITTED_VOTING_CONFIG_MSG =
"last committed voting voting configuration is empty, cluster has never been bootstrapped?";
Expand All @@ -81,7 +81,9 @@ public class UnsafeBootstrapMasterCommand extends OpenSearchNodeCommand {
private OptionSpec<Boolean> applyClusterReadOnlyBlockOption;

UnsafeBootstrapMasterCommand() {
super("Forces the successful election of the current node after the permanent loss of the half or more master-eligible nodes");
super(
"Forces the successful election of the current node after the permanent loss of the half or more cluster-manager-eligible nodes"
);
applyClusterReadOnlyBlockOption = parser.accepts("apply-cluster-read-only-block", "Optional cluster.blocks.read_only setting")
.withOptionalArg()
.ofType(Boolean.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ public List<DiscoveryNode> addedNodes() {
public String shortSummary() {
final StringBuilder summary = new StringBuilder();
if (masterNodeChanged()) {
summary.append("master node changed {previous [");
summary.append("cluster-manager node changed {previous [");
if (previousMasterNode() != null) {
summary.append(previousMasterNode());
}
Expand Down
Loading