Skip to content

Commit 79eb3b0

Browse files
author
Tianli Feng
authored
Replace internal usages of 'master' term in 'server/src/main' directory (#2519)
* Replace internal usages of 'master' terminology in server/src/main directory Signed-off-by: Tianli Feng <ftianli@amazon.com> * Restore rename DISCOVERED_MASTER in ClusterHealthResponse Signed-off-by: Tianli Feng <ftianli@amazon.com> * Rename two methods in unit tests Signed-off-by: Tianli Feng <ftianli@amazon.com> * Replace master word in ClusterState Signed-off-by: Tianli Feng <ftianli@amazon.com> * Replace master word in LeaderChecker JoinHelper JoinTaskExecutor Signed-off-by: Tianli Feng <ftianli@amazon.com> * Replace master word in more classes Signed-off-by: Tianli Feng <ftianli@amazon.com> * Replace master word in more classes Signed-off-by: Tianli Feng <ftianli@amazon.com> * Replace master word in more classes Signed-off-by: Tianli Feng <ftianli@amazon.com> * Replace master word in more classes Signed-off-by: Tianli Feng <ftianli@amazon.com> * Replace master word in more classes Signed-off-by: Tianli Feng <ftianli@amazon.com> * Replace master word in more classes Signed-off-by: Tianli Feng <ftianli@amazon.com> * Replace master word in DiscoveryNodes classes Signed-off-by: Tianli Feng <ftianli@amazon.com> * Replace master word in more classes Signed-off-by: Tianli Feng <ftianli@amazon.com> * Correct mistakes Signed-off-by: Tianli Feng <ftianli@amazon.com> * Adjust format by spotlessApply task Signed-off-by: Tianli Feng <ftianli@amazon.com> * Change MASTER__NODE_BOOTSTRAPPED_MSG in test Signed-off-by: Tianli Feng <ftianli@amazon.com> * Fix SnapshotDisruptionIT by renaming to cluster-manager Signed-off-by: Tianli Feng <ftianli@amazon.com>
1 parent 9da0a86 commit 79eb3b0

File tree

127 files changed

+679
-625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+679
-625
lines changed

server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private MockTerminal executeCommand(
111111
private MockTerminal unsafeBootstrap(Environment environment, boolean abort, Boolean applyClusterReadOnlyBlock) throws Exception {
112112
final MockTerminal terminal = executeCommand(new UnsafeBootstrapMasterCommand(), environment, 0, abort, applyClusterReadOnlyBlock);
113113
assertThat(terminal.getOutput(), containsString(UnsafeBootstrapMasterCommand.CONFIRMATION_MSG));
114-
assertThat(terminal.getOutput(), containsString(UnsafeBootstrapMasterCommand.MASTER_NODE_BOOTSTRAPPED_MSG));
114+
assertThat(terminal.getOutput(), containsString(UnsafeBootstrapMasterCommand.CLUSTER_MANAGER_NODE_BOOTSTRAPPED_MSG));
115115
return terminal;
116116
}
117117

@@ -171,7 +171,7 @@ public void testBootstrapNotMasterEligible() {
171171
final Environment environment = TestEnvironment.newEnvironment(
172172
Settings.builder().put(nonMasterNode(internalCluster().getDefaultSettings())).build()
173173
);
174-
expectThrows(() -> unsafeBootstrap(environment), UnsafeBootstrapMasterCommand.NOT_MASTER_NODE_MSG);
174+
expectThrows(() -> unsafeBootstrap(environment), UnsafeBootstrapMasterCommand.NOT_CLUSTER_MANAGER_NODE_MSG);
175175
}
176176

177177
public void testBootstrapNoDataFolder() {

server/src/internalClusterTest/java/org/opensearch/discovery/SnapshotDisruptionIT.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public void testMasterFailOverDuringShardSnapshots() throws Exception {
248248

249249
blockDataNode(repoName, dataNode);
250250

251-
logger.info("--> create snapshot via master node client");
251+
logger.info("--> create snapshot via cluster-manager node client");
252252
final ActionFuture<CreateSnapshotResponse> snapshotResponse = internalCluster().masterClient()
253253
.admin()
254254
.cluster()
@@ -272,7 +272,7 @@ public void testMasterFailOverDuringShardSnapshots() throws Exception {
272272
SnapshotException.class,
273273
() -> snapshotResponse.actionGet(TimeValue.timeValueSeconds(30L))
274274
);
275-
assertThat(sne.getMessage(), endsWith("no longer master"));
275+
assertThat(sne.getMessage(), endsWith("no longer cluster-manager"));
276276
}
277277

278278
private void assertSnapshotExists(String repository, String snapshot) {

server/src/internalClusterTest/java/org/opensearch/env/NodeRepurposeCommandIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private void executeRepurposeCommand(Settings settings, int expectedIndexCount,
136136
boolean verbose = randomBoolean();
137137
Settings settingsWithPath = Settings.builder().put(internalCluster().getDefaultSettings()).put(settings).build();
138138
Matcher<String> matcher = allOf(
139-
containsString(NodeRepurposeCommand.noMasterMessage(expectedIndexCount, expectedShardCount, 0)),
139+
containsString(NodeRepurposeCommand.noClusterManagerMessage(expectedIndexCount, expectedShardCount, 0)),
140140
NodeRepurposeCommandTests.conditionalNot(containsString("test-repurpose"), verbose == false)
141141
);
142142
NodeRepurposeCommandTests.verifySuccess(settingsWithPath, matcher, verbose);

server/src/main/java/org/opensearch/OpenSearchException.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ private enum OpenSearchExceptionHandle {
785785
2,
786786
UNKNOWN_VERSION_ADDED
787787
),
788-
MASTER_NOT_DISCOVERED_EXCEPTION(
788+
CLUSTER_MANAGER_NOT_DISCOVERED_EXCEPTION(
789789
org.opensearch.discovery.MasterNotDiscoveredException.class,
790790
org.opensearch.discovery.MasterNotDiscoveredException::new,
791791
3,
@@ -1496,7 +1496,7 @@ private enum OpenSearchExceptionHandle {
14961496
143,
14971497
UNKNOWN_VERSION_ADDED
14981498
),
1499-
NOT_MASTER_EXCEPTION(
1499+
NOT_CLUSTER_MANAGER_EXCEPTION(
15001500
org.opensearch.cluster.NotMasterException.class,
15011501
org.opensearch.cluster.NotMasterException::new,
15021502
144,

server/src/main/java/org/opensearch/action/admin/cluster/allocation/TransportClusterAllocationExplainAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565
/**
6666
* The {@code TransportClusterAllocationExplainAction} is responsible for actually executing the explanation of a shard's allocation on the
67-
* master node in the cluster.
67+
* cluster-manager node in the cluster.
6868
*/
6969
public class TransportClusterAllocationExplainAction extends TransportMasterNodeAction<
7070
ClusterAllocationExplainRequest,

server/src/main/java/org/opensearch/action/admin/cluster/health/ClusterHealthResponse.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo
9090
// ClusterStateHealth fields
9191
int numberOfNodes = (int) parsedObjects[i++];
9292
int numberOfDataNodes = (int) parsedObjects[i++];
93-
boolean hasDiscoveredMaster = Boolean.TRUE.equals(parsedObjects[i++]);
93+
boolean hasDiscoveredClusterManager = Boolean.TRUE.equals(parsedObjects[i++]);
9494
int activeShards = (int) parsedObjects[i++];
9595
int relocatingShards = (int) parsedObjects[i++];
9696
int activePrimaryShards = (int) parsedObjects[i++];
@@ -118,7 +118,7 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo
118118
unassignedShards,
119119
numberOfNodes,
120120
numberOfDataNodes,
121-
hasDiscoveredMaster,
121+
hasDiscoveredClusterManager,
122122
activeShardsPercent,
123123
status,
124124
indices

server/src/main/java/org/opensearch/action/admin/cluster/health/TransportClusterHealthAction.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,11 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS
218218
@Override
219219
public void onNoLongerMaster(String source) {
220220
logger.trace(
221-
"stopped being master while waiting for events with priority [{}]. retrying.",
221+
"stopped being cluster-manager while waiting for events with priority [{}]. retrying.",
222222
request.waitForEvents()
223223
);
224224
// TransportMasterNodeAction implements the retry logic, which is triggered by passing a NotMasterException
225-
listener.onFailure(new NotMasterException("no longer master. source: [" + source + "]"));
225+
listener.onFailure(new NotMasterException("no longer cluster-manager. source: [" + source + "]"));
226226
}
227227

228228
@Override

server/src/main/java/org/opensearch/action/admin/cluster/repositories/cleanup/TransportCleanupRepositoryAction.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@
7373
* <ol>
7474
* <li>Check that there are no running repository cleanup, snapshot create, or snapshot delete actions
7575
* and add an entry for the repository that is to be cleaned up to {@link RepositoryCleanupInProgress}</li>
76-
* <li>Run cleanup actions on the repository. Note, these are executed exclusively on the master node.
76+
* <li>Run cleanup actions on the repository. Note, these are executed exclusively on the cluster-manager node.
7777
* For the precise operations execute see {@link BlobStoreRepository#cleanup}</li>
7878
* <li>Remove the entry in {@link RepositoryCleanupInProgress} in the first step.</li>
7979
* </ol>
8080
*
81-
* On master failover during the cleanup operation it is simply removed from the cluster state. This is safe because the logic in
81+
* On cluster-manager failover during the cleanup operation it is simply removed from the cluster state. This is safe because the logic in
8282
* {@link BlobStoreRepository#cleanup} ensures that the repository state id has not changed between creation of the cluster state entry
8383
* and any delete/write operations. TODO: This will not work if we also want to clean up at the shard level as those will involve writes
8484
* as well as deletes.
@@ -119,7 +119,7 @@ public TransportCleanupRepositoryAction(
119119
);
120120
this.repositoriesService = repositoriesService;
121121
this.snapshotsService = snapshotsService;
122-
// We add a state applier that will remove any dangling repository cleanup actions on master failover.
122+
// We add a state applier that will remove any dangling repository cleanup actions on cluster-manager failover.
123123
// This is safe to do since cleanups will increment the repository state id before executing any operations to prevent concurrent
124124
// operations from corrupting the repository. This is the same safety mechanism used by snapshot deletes.
125125
if (DiscoveryNode.isMasterNode(clusterService.getSettings())) {
@@ -136,7 +136,7 @@ private static void addClusterStateApplier(ClusterService clusterService) {
136136
return;
137137
}
138138
clusterService.submitStateUpdateTask(
139-
"clean up repository cleanup task after master failover",
139+
"clean up repository cleanup task after cluster-manager failover",
140140
new ClusterStateUpdateTask() {
141141
@Override
142142
public ClusterState execute(ClusterState currentState) {

server/src/main/java/org/opensearch/action/admin/cluster/settings/TransportClusterUpdateSettingsAction.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ public void onAckTimeout() {
155155
}
156156

157157
private void reroute(final boolean updateSettingsAcked) {
158-
// We're about to send a second update task, so we need to check if we're still the elected master
159-
// For example the minimum_master_node could have been breached and we're no longer elected master,
158+
// We're about to send a second update task, so we need to check if we're still the elected cluster-manager
159+
// For example the minimum_master_node could have been breached and we're no longer elected cluster-manager,
160160
// so we should *not* execute the reroute.
161161
if (!clusterService.state().nodes().isLocalNodeElectedMaster()) {
162-
logger.debug("Skipping reroute after cluster update settings, because node is no longer master");
162+
logger.debug("Skipping reroute after cluster update settings, because node is no longer cluster-manager");
163163
listener.onResponse(
164164
new ClusterUpdateSettingsResponse(
165165
updateSettingsAcked,
@@ -198,7 +198,7 @@ protected ClusterUpdateSettingsResponse newResponse(boolean acknowledged) {
198198
@Override
199199
public void onNoLongerMaster(String source) {
200200
logger.debug(
201-
"failed to preform reroute after cluster settings were updated - current node is no longer a master"
201+
"failed to preform reroute after cluster settings were updated - current node is no longer a cluster-manager"
202202
);
203203
listener.onResponse(
204204
new ClusterUpdateSettingsResponse(

server/src/main/java/org/opensearch/action/admin/cluster/snapshots/restore/RestoreClusterStateListener.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ public void clusterChanged(ClusterChangedEvent changedEvent) {
6969
final RestoreInProgress.Entry prevEntry = restoreInProgress(changedEvent.previousState(), uuid);
7070
final RestoreInProgress.Entry newEntry = restoreInProgress(changedEvent.state(), uuid);
7171
if (prevEntry == null) {
72-
// When there is a master failure after a restore has been started, this listener might not be registered
73-
// on the current master and as such it might miss some intermediary cluster states due to batching.
72+
// When there is a cluster-manager failure after a restore has been started, this listener might not be registered
73+
// on the current cluster-manager and as such it might miss some intermediary cluster states due to batching.
7474
// Clean up listener in that case and acknowledge completion of restore operation to client.
7575
clusterService.removeListener(this);
7676
listener.onResponse(new RestoreSnapshotResponse((RestoreInfo) null));

server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ private void buildResponse(
221221
// Unlikely edge case:
222222
// Data node has finished snapshotting the shard but the cluster state has not yet been updated
223223
// to reflect this. We adjust the status to show up as snapshot metadata being written because
224-
// technically if the data node failed before successfully reporting DONE state to master, then
225-
// this shards state would jump to a failed state.
224+
// technically if the data node failed before successfully reporting DONE state to cluster-manager,
225+
// then this shards state would jump to a failed state.
226226
shardStatus = new SnapshotIndexShardStatus(
227227
shardEntry.key,
228228
SnapshotIndexShardStage.FINALIZE,
@@ -406,7 +406,7 @@ private SnapshotInfo snapshot(SnapshotsInProgress snapshotsInProgress, String re
406406
/**
407407
* Returns status of shards currently finished snapshots
408408
* <p>
409-
* This method is executed on master node and it's complimentary to the
409+
* This method is executed on cluster-manager node and it's complimentary to the
410410
* {@link SnapshotShardsService#currentSnapshotShards(Snapshot)} because it
411411
* returns similar information but for already finished snapshots.
412412
* </p>

server/src/main/java/org/opensearch/action/admin/cluster/state/ClusterStateResponse.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,20 @@ public boolean equals(Object o) {
108108
if (o == null || getClass() != o.getClass()) return false;
109109
ClusterStateResponse response = (ClusterStateResponse) o;
110110
return waitForTimedOut == response.waitForTimedOut && Objects.equals(clusterName, response.clusterName) &&
111-
// Best effort. Only compare cluster state version and master node id,
111+
// Best effort. Only compare cluster state version and cluster-manager node id,
112112
// because cluster state doesn't implement equals()
113113
Objects.equals(getVersion(clusterState), getVersion(response.clusterState))
114-
&& Objects.equals(getMasterNodeId(clusterState), getMasterNodeId(response.clusterState));
114+
&& Objects.equals(getClusterManagerNodeId(clusterState), getClusterManagerNodeId(response.clusterState));
115115
}
116116

117117
@Override
118118
public int hashCode() {
119-
// Best effort. Only use cluster state version and master node id,
119+
// Best effort. Only use cluster state version and cluster-manager node id,
120120
// because cluster state doesn't implement hashcode()
121-
return Objects.hash(clusterName, getVersion(clusterState), getMasterNodeId(clusterState), waitForTimedOut);
121+
return Objects.hash(clusterName, getVersion(clusterState), getClusterManagerNodeId(clusterState), waitForTimedOut);
122122
}
123123

124-
private static String getMasterNodeId(ClusterState clusterState) {
124+
private static String getClusterManagerNodeId(ClusterState clusterState) {
125125
if (clusterState == null) {
126126
return null;
127127
}

server/src/main/java/org/opensearch/action/admin/cluster/state/TransportClusterStateAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void onNewClusterState(ClusterState newState) {
138138
} else {
139139
listener.onFailure(
140140
new NotMasterException(
141-
"master stepped down waiting for metadata version " + request.waitForMetadataVersion()
141+
"cluster-manager stepped down waiting for metadata version " + request.waitForMetadataVersion()
142142
)
143143
);
144144
}

server/src/main/java/org/opensearch/action/admin/cluster/stats/ClusterStatsNodeResponse.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public NodeStats nodeStats() {
8585
}
8686

8787
/**
88-
* Cluster Health Status, only populated on master nodes.
88+
* Cluster Health Status, only populated on cluster-manager nodes.
8989
*/
9090
@Nullable
9191
public ClusterHealthStatus clusterStatus() {

server/src/main/java/org/opensearch/action/admin/cluster/stats/ClusterStatsResponse.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class ClusterStatsResponse extends BaseNodesResponse<ClusterStatsNodeResp
6060
public ClusterStatsResponse(StreamInput in) throws IOException {
6161
super(in);
6262
timestamp = in.readVLong();
63-
// it may be that the master switched on us while doing the operation. In this case the status may be null.
63+
// it may be that the cluster-manager switched on us while doing the operation. In this case the status may be null.
6464
status = in.readOptionalWriteable(ClusterHealthStatus::readFrom);
6565

6666
String clusterUUID = null;
@@ -93,7 +93,7 @@ public ClusterStatsResponse(
9393
indicesStats = new ClusterStatsIndices(nodes, MappingStats.of(state), AnalysisStats.of(state));
9494
ClusterHealthStatus status = null;
9595
for (ClusterStatsNodeResponse response : nodes) {
96-
// only the master node populates the status
96+
// only the cluster-manager node populates the status
9797
if (response.clusterStatus() != null) {
9898
status = response.clusterStatus();
9999
break;

server/src/main/java/org/opensearch/action/admin/indices/dangling/package-info.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
* <ul>
3434
* <li>A user overflows the index graveyard by deleting more than 500 indices while a node is offline and then the node rejoins the
3535
* cluster</li>
36-
* <li>A node (unsafely) moves from one cluster to another, perhaps because the original cluster lost all its master nodes</li>
36+
* <li>A node (unsafely) moves from one cluster to another, perhaps because the original cluster lost all its cluster-manager nodes</li>
3737
* <li>A user (unsafely) meddles with the contents of the data path, maybe restoring an old index folder from a backup</li>
3838
* <li>A disk partially fails and the user has no replicas and no snapshots and wants to (unsafely) recover whatever they can</li>
39-
* <li>A cluster loses all master nodes and those are (unsafely) restored from backup, but the backup does not contain the index</li>
39+
* <li>A cluster loses all cluster-manager nodes and those are (unsafely) restored from backup, but the backup does not contain the index</li>
4040
* </ul>
4141
*
4242
* <p>The classes in this package form an API for managing dangling indices, allowing them to be listed, imported or deleted.

server/src/main/java/org/opensearch/action/bulk/BulkPrimaryExecutionContext.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ enum ItemProcessingState {
6161
TRANSLATED,
6262
/**
6363
* the request can not execute with the current mapping and should wait for a new mapping
64-
* to arrive from the master. A mapping request for the needed changes has already been
64+
* to arrive from the cluster-manager. A mapping request for the needed changes has already been
6565
* submitted
6666
*/
6767
WAIT_FOR_MAPPING_UPDATE,
@@ -144,7 +144,7 @@ public boolean isOperationExecuted() {
144144
return currentItemState == ItemProcessingState.EXECUTED;
145145
}
146146

147-
/** returns true if the request needs to wait for a mapping update to arrive from the master */
147+
/** returns true if the request needs to wait for a mapping update to arrive from the cluster-manager */
148148
public boolean requiresWaitingForMappingUpdate() {
149149
return currentItemState == ItemProcessingState.WAIT_FOR_MAPPING_UPDATE;
150150
}
@@ -216,7 +216,7 @@ public <T extends DocWriteRequest<T>> T getRequestToExecute() {
216216
return (T) requestToExecute;
217217
}
218218

219-
/** indicates that the current operation can not be completed and needs to wait for a new mapping from the master */
219+
/** indicates that the current operation can not be completed and needs to wait for a new mapping from the cluster-manager */
220220
public void markAsRequiringMappingUpdate() {
221221
assert assertInvariants(ItemProcessingState.TRANSLATED);
222222
currentItemState = ItemProcessingState.WAIT_FOR_MAPPING_UPDATE;

server/src/main/java/org/opensearch/action/bulk/MappingUpdatePerformer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
public interface MappingUpdatePerformer {
4040

4141
/**
42-
* Update the mappings on the master.
42+
* Update the mappings on the cluster-manager.
4343
*/
4444
void updateMappings(Mapping update, ShardId shardId, ActionListener<Void> listener);
4545

server/src/main/java/org/opensearch/action/bulk/TransportShardBulkAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ private static Engine.Result performOpOnReplica(
621621
throw new IllegalStateException("Unexpected request operation type on replica: " + docWriteRequest.opType().getLowercase());
622622
}
623623
if (result.getResultType() == Engine.Result.Type.MAPPING_UPDATE_REQUIRED) {
624-
// Even though the primary waits on all nodes to ack the mapping changes to the master
624+
// Even though the primary waits on all nodes to ack the mapping changes to the cluster-manager
625625
// (see MappingUpdatedAction.updateMappingOnMaster) we still need to protect against missing mappings
626626
// and wait for them. The reason is concurrent requests. Request r1 which has new field f triggers a
627627
// mapping update. Assume that that update is first applied on the primary, and only later on the replica

0 commit comments

Comments
 (0)