Skip to content

Commit

Permalink
Replace master word in more classes
Browse files Browse the repository at this point in the history
Signed-off-by: Tianli Feng <ftianli@amazon.com>
  • Loading branch information
Tianli Feng committed Apr 26, 2022
1 parent 32534b8 commit d5660fd
Show file tree
Hide file tree
Showing 65 changed files with 244 additions and 244 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

/**
* The {@code TransportClusterAllocationExplainAction} is responsible for actually executing the explanation of a shard's allocation on the
* master node in the cluster.
* cluster-manager node in the cluster.
*/
public class TransportClusterAllocationExplainAction extends TransportMasterNodeAction<
ClusterAllocationExplainRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS
@Override
public void onNoLongerMaster(String source) {
logger.trace(
"stopped being master while waiting for events with priority [{}]. retrying.",
"stopped being cluster-manager while waiting for events with priority [{}]. retrying.",
request.waitForEvents()
);
// TransportMasterNodeAction implements the retry logic, which is triggered by passing a NotMasterException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@
* <ol>
* <li>Check that there are no running repository cleanup, snapshot create, or snapshot delete actions
* and add an entry for the repository that is to be cleaned up to {@link RepositoryCleanupInProgress}</li>
* <li>Run cleanup actions on the repository. Note, these are executed exclusively on the master node.
* <li>Run cleanup actions on the repository. Note, these are executed exclusively on the cluster-manager node.
* For the precise operations execute see {@link BlobStoreRepository#cleanup}</li>
* <li>Remove the entry in {@link RepositoryCleanupInProgress} in the first step.</li>
* </ol>
*
* On master failover during the cleanup operation it is simply removed from the cluster state. This is safe because the logic in
* On cluster-manager failover during the cleanup operation it is simply removed from the cluster state. This is safe because the logic in
* {@link BlobStoreRepository#cleanup} ensures that the repository state id has not changed between creation of the cluster state entry
* 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
* as well as deletes.
Expand Down Expand Up @@ -119,7 +119,7 @@ public TransportCleanupRepositoryAction(
);
this.repositoriesService = repositoriesService;
this.snapshotsService = snapshotsService;
// We add a state applier that will remove any dangling repository cleanup actions on master failover.
// We add a state applier that will remove any dangling repository cleanup actions on cluster-manager failover.
// This is safe to do since cleanups will increment the repository state id before executing any operations to prevent concurrent
// operations from corrupting the repository. This is the same safety mechanism used by snapshot deletes.
if (DiscoveryNode.isMasterNode(clusterService.getSettings())) {
Expand All @@ -136,7 +136,7 @@ private static void addClusterStateApplier(ClusterService clusterService) {
return;
}
clusterService.submitStateUpdateTask(
"clean up repository cleanup task after master failover",
"clean up repository cleanup task after cluster-manager failover",
new ClusterStateUpdateTask() {
@Override
public ClusterState execute(ClusterState currentState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ private SnapshotInfo snapshot(SnapshotsInProgress snapshotsInProgress, String re
/**
* Returns status of shards currently finished snapshots
* <p>
* This method is executed on master node and it's complimentary to the
* This method is executed on cluster-manager node and it's complimentary to the
* {@link SnapshotShardsService#currentSnapshotShards(Snapshot)} because it
* returns similar information but for already finished snapshots.
* </p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
* <ul>
* <li>A user overflows the index graveyard by deleting more than 500 indices while a node is offline and then the node rejoins the
* cluster</li>
* <li>A node (unsafely) moves from one cluster to another, perhaps because the original cluster lost all its master nodes</li>
* <li>A node (unsafely) moves from one cluster to another, perhaps because the original cluster lost all its cluster-manager nodes</li>
* <li>A user (unsafely) meddles with the contents of the data path, maybe restoring an old index folder from a backup</li>
* <li>A disk partially fails and the user has no replicas and no snapshots and wants to (unsafely) recover whatever they can</li>
* <li>A cluster loses all master nodes and those are (unsafely) restored from backup, but the backup does not contain the index</li>
* <li>A cluster loses all cluster-manager nodes and those are (unsafely) restored from backup, but the backup does not contain the index</li>
* </ul>
*
* <p>The classes in this package form an API for managing dangling indices, allowing them to be listed, imported or deleted.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.opensearch.common.unit.TimeValue;

/**
* Base request builder for master node operations that support acknowledgements
* Base request builder for cluster-manager node operations that support acknowledgements
*/
public abstract class AcknowledgedRequestBuilder<
Request extends AcknowledgedRequest<Request>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import org.opensearch.common.unit.TimeValue;

/**
* Base request builder for master node operations
* Base request builder for cluster-manager node operations
*/
public abstract class MasterNodeOperationRequestBuilder<
Request extends MasterNodeRequest<Request>,
Expand All @@ -53,7 +53,7 @@ protected MasterNodeOperationRequestBuilder(OpenSearchClient client, ActionType<
}

/**
* Sets the master node timeout in case the master has not yet been discovered.
* Sets the cluster-manager node timeout in case the cluster-manager has not yet been discovered.
*/
@SuppressWarnings("unchecked")
public final RequestBuilder setMasterNodeTimeout(TimeValue timeout) {
Expand All @@ -62,7 +62,7 @@ public final RequestBuilder setMasterNodeTimeout(TimeValue timeout) {
}

/**
* Sets the master node timeout in case the master has not yet been discovered.
* Sets the cluster-manager node timeout in case the cluster-manager has not yet been discovered.
*/
@SuppressWarnings("unchecked")
public final RequestBuilder setMasterNodeTimeout(String timeout) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.opensearch.client.OpenSearchClient;

/**
* Base request builder for master node read operations that can be executed on the local node as well
* Base request builder for cluster-manager node read operations that can be executed on the local node as well
*/
public abstract class MasterNodeReadOperationRequestBuilder<
Request extends MasterNodeReadRequest<Request>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import java.io.IOException;

/**
* Base request for master based read operations that allows to read the cluster state from the local node if needed
* Base request for cluster-manager based read operations that allows to read the cluster state from the local node if needed
*/
public abstract class MasterNodeReadRequest<Request extends MasterNodeReadRequest<Request>> extends MasterNodeRequest<Request> {

Expand All @@ -64,9 +64,9 @@ public final Request local(boolean local) {
}

/**
* Return local information, do not retrieve the state from master node (default: false).
* Return local information, do not retrieve the state from cluster-manager node (default: false).
* @return <code>true</code> if local information is to be returned;
* <code>false</code> if information is to be retrieved from master node (default).
* <code>false</code> if information is to be retrieved from cluster-manager node (default).
*/
public final boolean local() {
return local;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ protected void doStart(ClusterState clusterState) {
}
} else {
if (nodes.getMasterNode() == null) {
logger.debug("no known master node, scheduling a retry");
logger.debug("no known cluster-manager node, scheduling a retry");
retryOnMasterChange(clusterState, null);
} else {
DiscoveryNode clusterManagerNode = nodes.getMasterNode();
Expand All @@ -213,7 +213,7 @@ public void handleException(final TransportException exp) {
Throwable cause = exp.unwrapCause();
if (cause instanceof ConnectTransportException
|| (exp instanceof RemoteTransportException && cause instanceof NodeClosedException)) {
// we want to retry here a bit to see if a new master is elected
// we want to retry here a bit to see if a new cluster-manager is elected
logger.debug(
"connection exception while trying to forward request with action name [{}] to "
+ "master node [{}], scheduling a retry. Error: [{}]",
Expand Down Expand Up @@ -279,7 +279,7 @@ public void onTimeout(TimeValue timeout) {
}

/**
* Allows to conditionally return a different master node action name in the case an action gets renamed.
* Allows to conditionally return a different cluster-manager node action name in the case an action gets renamed.
* This mainly for backwards compatibility should be used rarely
*/
protected String getMasterActionName(DiscoveryNode node) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.opensearch.transport.TransportService;

/**
* A base class for read operations that needs to be performed on the master node.
* A base class for read operations that needs to be performed on the cluster-manager node.
* Can also be executed on the local node if needed.
*/
public abstract class TransportMasterNodeReadAction<Request extends MasterNodeReadRequest<Request>, Response extends ActionResponse> extends
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

import java.io.IOException;

// TODO: this class can be removed in master once 7.x is bumped to 7.4.0
// TODO: this class can be removed in main once 7.x is bumped to 7.4.0
public abstract class BaseNodeRequest extends TransportRequest {

public BaseNodeRequest() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ protected void doExecute(Task task, final UpdateRequest request, final ActionLis
request.index()
);
}
// if we don't have a master, we don't have metadata, that's fine, let it find a master using create index API
// if we don't have a master, we don't have metadata, that's fine, let it find a cluster-manager using create index API
if (autoCreateIndex.shouldAutoCreate(request.index(), clusterService.state())) {
client.admin()
.indices()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public boolean nodesChanged() {
* Determines whether or not the current cluster state represents an entirely
* new cluster, either when a node joins a cluster for the first time or when
* the node receives a cluster state update from a brand new cluster (different
* UUID from the previous cluster), which will happen when a master node is
* UUID from the previous cluster), which will happen when a cluster-manager node is
* elected that has never been part of the cluster before.
*/
public boolean isNewCluster() {
Expand All @@ -260,8 +260,8 @@ public boolean isNewCluster() {
// Get the deleted indices by comparing the index metadatas in the previous and new cluster states.
// If an index exists in the previous cluster state, but not in the new cluster state, it must have been deleted.
private List<Index> indicesDeletedFromClusterState() {
// If the new cluster state has a new cluster UUID, the likely scenario is that a node was elected
// master that has had its data directory wiped out, in which case we don't want to delete the indices and lose data;
// If the new cluster state has a new cluster UUID, the likely scenario is that a node was elected cluster-manager
// that has had its data directory wiped out, in which case we don't want to delete the indices and lose data;
// rather we want to import them as dangling indices instead. So we check here if the cluster UUID differs from the previous
// cluster UUID, in which case, we don't want to delete indices that the cluster-manager erroneously believes shouldn't exist.
// See test DiscoveryWithServiceDisruptionsIT.testIndicesDeleted()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public Priority priority() {
}

/**
* Marked as final as cluster state update tasks should only run on master.
* Marked as final as cluster state update tasks should only run on cluster-manager.
* For local requests, use {@link LocalClusterUpdateTask} instead.
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,29 @@
package org.opensearch.cluster;

/**
* Enables listening to master changes events of the local node (when the local node becomes the master, and when the local
* node cease being a master).
* Enables listening to cluster-manager changes events of the local node (when the local node becomes the cluster-manager, and when the local
* node cease being a cluster-manager).
*/
public interface LocalNodeMasterListener extends ClusterStateListener {

/**
* Called when local node is elected to be the master
* Called when local node is elected to be the cluster-manager
*/
void onMaster();
void onClusterManager();

/**
* Called when the local node used to be the master, a new master was elected and it's no longer the local node.
* Called when the local node used to be the cluster-manager, a new cluster-manager was elected and it's no longer the local node.
*/
void offMaster();
void offClusterManager();

@Override
default void clusterChanged(ClusterChangedEvent event) {
final boolean wasMaster = event.previousState().nodes().isLocalNodeElectedMaster();
final boolean isMaster = event.localNodeMaster();
if (wasMaster == false && isMaster) {
onMaster();
} else if (wasMaster && isMaster == false) {
offMaster();
final boolean wasClusterManager = event.previousState().nodes().isLocalNodeElectedMaster();
final boolean isClusterManager = event.localNodeMaster();
if (wasClusterManager == false && isClusterManager) {
onClusterManager();
} else if (wasClusterManager && isClusterManager == false) {
offClusterManager();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
* This component is responsible for maintaining connections from this node to all the nodes listed in the cluster state, and for
* disconnecting from nodes once they are removed from the cluster state. It periodically checks that all connections are still open and
* restores them if needed. Note that this component is *not* responsible for removing nodes from the cluster state if they disconnect or
* are unresponsive: this is the job of the master's fault detection components, particularly {@link FollowersChecker}.
* are unresponsive: this is the job of the cluster-manager's fault detection components, particularly {@link FollowersChecker}.
* <p>
* The {@link NodeConnectionsService#connectToNodes(DiscoveryNodes, Runnable)} and {@link
* NodeConnectionsService#disconnectFromNodesExcept(DiscoveryNodes)} methods are called on the {@link ClusterApplier} thread. This component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
import java.io.IOException;

/**
* Thrown when a node join request or a master ping reaches a node which is not
* currently acting as a master or when a cluster state update task is to be executed
* on a node that is no longer master.
* Thrown when a node join request or a cluster-manager ping reaches a node which is not
* currently acting as a cluster-manager or when a cluster state update task is to be executed
* on a node that is no longer cluster-manager.
*/
public class NotMasterException extends OpenSearchException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ private Entry(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(VERSION_IN_SNAPSHOT_VERSION)) {
version = Version.readVersion(in);
} else if (in.getVersion().onOrAfter(SnapshotsService.SHARD_GEN_IN_REPO_DATA_VERSION)) {
// If an older master informs us that shard generations are supported we use the minimum shard generation compatible
// If an older cluster-manager informs us that shard generations are supported we use the minimum shard generation compatible
// version. If shard generations are not supported yet we use a placeholder for a version that does not use shard
// generations.
version = in.readBoolean() ? SnapshotsService.SHARD_GEN_IN_REPO_DATA_VERSION : SnapshotsService.OLD_SNAPSHOT_FORMAT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public interface AckedRequest {
TimeValue ackTimeout();

/**
* Returns the timeout for the request to be completed on the master node
* Returns the timeout for the request to be completed on the cluster-manager node
*/
TimeValue masterNodeTimeout();
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ public T ackTimeout(TimeValue ackTimeout) {

/**
* Returns the maximum time interval to wait for the request to
* be completed on the master node
* be completed on the cluster-manager node
*/
@Override
public TimeValue masterNodeTimeout() {
return masterNodeTimeout;
}

/**
* Sets the master node timeout
* Sets the cluster-manager node timeout
*/
@SuppressWarnings("unchecked")
public T masterNodeTimeout(TimeValue masterNodeTimeout) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public NodeMappingRefreshAction(TransportService transportService, MetadataMappi

public void nodeMappingRefresh(final DiscoveryNode clusterManagerNode, final NodeMappingRefreshRequest request) {
if (clusterManagerNode == null) {
logger.warn("can't send mapping refresh for [{}], no master known.", request.index());
logger.warn("can't send mapping refresh for [{}], no cluster-manager known.", request.index());
return;
}
transportService.sendRequest(clusterManagerNode, ACTION_NAME, request, EmptyTransportResponseHandler.INSTANCE_SAME);
Expand Down
Loading

0 comments on commit d5660fd

Please sign in to comment.