Skip to content

More removal of deprecated 'master' code #17218

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

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -946,14 +946,6 @@ Params withFields(String[] fields) {
return this;
}

/**
* @deprecated As of 2.0, because supporting inclusive language, replaced by {@link #withClusterManagerTimeout(TimeValue)}
*/
@Deprecated
Params withMasterTimeout(TimeValue clusterManagerTimeout) {
return putParam("master_timeout", clusterManagerTimeout);
}

Params withClusterManagerTimeout(TimeValue clusterManagerTimeout) {
return putParam("cluster_manager_timeout", clusterManagerTimeout);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ public abstract class TimedRequest implements Validatable {

public static final TimeValue DEFAULT_ACK_TIMEOUT = timeValueSeconds(30);
public static final TimeValue DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT = TimeValue.timeValueSeconds(30);
/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT} */
@Deprecated
public static final TimeValue DEFAULT_MASTER_NODE_TIMEOUT = DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT;

private TimeValue timeout = DEFAULT_ACK_TIMEOUT;
private TimeValue clusterManagerTimeout = DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT;
Expand All @@ -68,16 +65,6 @@ public void setClusterManagerTimeout(TimeValue clusterManagerTimeout) {
this.clusterManagerTimeout = clusterManagerTimeout;
}

/**
* Sets the timeout to connect to the cluster-manager node
* @param clusterManagerTimeout timeout as a {@link TimeValue}
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerTimeout(TimeValue)}
*/
@Deprecated
public void setMasterTimeout(TimeValue clusterManagerTimeout) {
setClusterManagerTimeout(clusterManagerTimeout);
}

/**
* Returns the request timeout
*/
Expand All @@ -91,13 +78,4 @@ public TimeValue timeout() {
public TimeValue clusterManagerNodeTimeout() {
return clusterManagerTimeout;
}

/**
* Returns the timeout for the request to be completed on the cluster-manager node
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerNodeTimeout()}
*/
@Deprecated
public TimeValue masterNodeTimeout() {
return clusterManagerNodeTimeout();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,10 @@ public TimeValue getClusterManagerNodeTimeout() {
return clusterManagerNodeTimeout;
}

/**
* @return the timeout for waiting for the cluster-manager node to respond
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getMasterNodeTimeout()}
*/
@Deprecated
public TimeValue getMasterNodeTimeout() {
return getClusterManagerNodeTimeout();
}

public void setClusterManagerNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
this.clusterManagerNodeTimeout = clusterManagerNodeTimeout;
}

/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(TimeValue)} */
@Deprecated
public void setMasterNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
}

public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
final TimeValue timeValue = TimeValue.parseTimeValue(
clusterManagerNodeTimeout,
Expand All @@ -98,12 +83,6 @@ public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
setClusterManagerNodeTimeout(timeValue);
}

/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(String)} */
@Deprecated
public void setMasterNodeTimeout(String clusterManagerNodeTimeout) {
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
}

/**
* @return true if this request is to read from the local cluster state, rather than the cluster-manager node - false otherwise
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,10 @@ public TimeValue getClusterManagerNodeTimeout() {
return clusterManagerNodeTimeout;
}

/**
* @return the timeout for waiting for the cluster-manager node to respond
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getMasterNodeTimeout()}
*/
@Deprecated
public TimeValue getMasterNodeTimeout() {
return getClusterManagerNodeTimeout();
}

public void setClusterManagerNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
this.clusterManagerNodeTimeout = clusterManagerNodeTimeout;
}

/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(TimeValue)} */
@Deprecated
public void setMasterNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
}

public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
final TimeValue timeValue = TimeValue.parseTimeValue(
clusterManagerNodeTimeout,
Expand All @@ -98,12 +83,6 @@ public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
setClusterManagerNodeTimeout(timeValue);
}

/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(String)} */
@Deprecated
public void setMasterNodeTimeout(String clusterManagerNodeTimeout) {
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
}

/**
* @return true if this request is to read from the local cluster state, rather than the cluster-manager node - false otherwise
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,25 +90,10 @@ public TimeValue getClusterManagerNodeTimeout() {
return clusterManagerNodeTimeout;
}

/**
* @return the timeout for waiting for the cluster-manager node to respond
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getMasterNodeTimeout()}
*/
@Deprecated
public TimeValue getMasterNodeTimeout() {
return getClusterManagerNodeTimeout();
}

public void setClusterManagerNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
this.clusterManagerNodeTimeout = clusterManagerNodeTimeout;
}

/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(TimeValue)} */
@Deprecated
public void setMasterNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
}

public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
final TimeValue timeValue = TimeValue.parseTimeValue(
clusterManagerNodeTimeout,
Expand All @@ -117,12 +102,6 @@ public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
setClusterManagerNodeTimeout(timeValue);
}

/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(String)} */
@Deprecated
public void setMasterNodeTimeout(String clusterManagerNodeTimeout) {
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
}

/**
* @return true if this request is to read from the local cluster state, rather than the cluster-manager node - false otherwise
*/
Expand Down
9 changes: 0 additions & 9 deletions client/rest/src/main/java/org/opensearch/client/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,6 @@ public boolean isClusterManagerEligible() {
return roles.contains("master") || roles.contains("cluster_manager");
}

/**
* Returns whether or not the node <strong>could</strong> be elected cluster-manager.
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #isClusterManagerEligible()}
*/
@Deprecated
public boolean isMasterEligible() {
return isClusterManagerEligible();
}

/**
* Returns whether or not the node stores data.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public void testSnapshotShardBlobDeletionRepositoryThrowingError() throws Except
createFullSnapshot(repositoryName, secondSnapshot);

// Make repository to throw exception when trying to delete stale snapshot shard blobs
String clusterManagerNode = internalCluster().getMasterName();
String clusterManagerNode = internalCluster().getClusterManagerName();
((MockRepository) internalCluster().getInstance(RepositoriesService.class, clusterManagerNode).repository("test-repo"))
.setThrowExceptionWhileDelete(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,6 @@ public boolean hasDiscoveredClusterManager() {
return clusterStateHealth.hasDiscoveredClusterManager();
}

/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #hasDiscoveredClusterManager()} */
@Deprecated
public boolean hasDiscoveredMaster() {
return hasDiscoveredClusterManager();
}

public int getNumberOfPendingTasks() {
return this.numberOfPendingTasks;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,35 +161,16 @@

protected abstract Response read(StreamInput in) throws IOException;

/**
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerOperation(ClusterManagerNodeRequest, ClusterState, ActionListener)}
*/
@Deprecated
protected void masterOperation(Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
throw new UnsupportedOperationException("Must be overridden");
}

// TODO: Add abstract keyword after removing the deprecated masterOperation()
protected void clusterManagerOperation(Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
masterOperation(request, state, listener);
}
protected abstract void clusterManagerOperation(Request request, ClusterState state, ActionListener<Response> listener)
throws Exception;

/**
* Override this operation if access to the task parameter is needed
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerOperation(Task, ClusterManagerNodeRequest, ClusterState, ActionListener)}
*/
@Deprecated
protected void masterOperation(Task task, Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
clusterManagerOperation(request, state, listener);
}

/**
* Override this operation if access to the task parameter is needed
*/
// TODO: Change the implementation to call 'clusterManagerOperation(request...)' after removing the deprecated masterOperation()
protected void clusterManagerOperation(Task task, Request request, ClusterState state, ActionListener<Response> listener)
throws Exception {
masterOperation(task, request, state, listener);
clusterManagerOperation(request, state, listener);
}

protected boolean localExecute(Request request) {
Expand Down Expand Up @@ -265,7 +246,7 @@
*/
@Override
public Exception getTimeoutException(Exception e) {
return new ProcessClusterEventTimeoutException(request.masterNodeTimeout, actionName);
return new ProcessClusterEventTimeoutException(request.clusterManagerNodeTimeout, actionName);

Check warning on line 249 in server/src/main/java/org/opensearch/action/support/clustermanager/TransportClusterManagerNodeAction.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/action/support/clustermanager/TransportClusterManagerNodeAction.java#L249

Added line #L249 was not covered by tests
}

protected void doStart(ClusterState clusterState) {
Expand Down Expand Up @@ -551,17 +532,6 @@
return actionName;
}

/**
* 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
*
* @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #getClusterManagerActionName(DiscoveryNode)}
*/
@Deprecated
protected String getMasterActionName(DiscoveryNode node) {
return getClusterManagerActionName(node);
}

/**
* Override to true if the transport action can be executed locally and need NOT be executed always on cluster-manager (Read actions).
* The action is executed locally if this method returns true AND
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,34 +77,16 @@ protected ClusterBlockException checkBlock(Request request, ClusterState state)
.indicesBlockedException(ClusterBlockLevel.METADATA_READ, indexNameExpressionResolver.concreteIndexNames(state, request));
}

/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerOperation(ClusterInfoRequest, ClusterState, ActionListener)} */
@Deprecated
protected final void masterOperation(final Request request, final ClusterState state, final ActionListener<Response> listener) {
clusterManagerOperation(request, state, listener);
}

@Override
protected final void clusterManagerOperation(final Request request, final ClusterState state, final ActionListener<Response> listener) {
String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(state, request);
doClusterManagerOperation(request, concreteIndices, state, listener);
}

// TODO: Add abstract keyword after removing the deprecated doMasterOperation()
protected void doClusterManagerOperation(
protected abstract void doClusterManagerOperation(
Request request,
String[] concreteIndices,
ClusterState state,
ActionListener<Response> listener
) {
doMasterOperation(request, concreteIndices, state, listener);
}

/**
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #doClusterManagerOperation(ClusterInfoRequest, String[], ClusterState, ActionListener)}
*/
@Deprecated
protected void doMasterOperation(Request request, String[] concreteIndices, ClusterState state, ActionListener<Response> listener) {
throw new UnsupportedOperationException("Must be overridden");
}

);
}
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,6 @@ public boolean localNodeClusterManager() {
return state.nodes().isLocalNodeElectedClusterManager();
}

/**
* Returns <code>true</code> iff the local node is the mater node of the cluster.
*
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #localNodeClusterManager()}
*/
@Deprecated
public boolean localNodeMaster() {
return localNodeClusterManager();
}

/**
* Returns the {@link org.opensearch.cluster.node.DiscoveryNodes.Delta} between
* the previous cluster state and the new cluster state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,6 @@ default boolean runOnlyOnClusterManager() {
return true;
}

/**
* indicates whether this executor should only run if the current node is cluster-manager
*
* @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #runOnlyOnClusterManager()}
*/
@Deprecated
default boolean runOnlyOnMaster() {
return runOnlyOnClusterManager();
}

/**
* Callback invoked after new cluster state is published. Note that
* this method is not invoked if the cluster state was not updated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ default void onNoLongerClusterManager(String source) {
onFailure(source, new NotClusterManagerException("no longer cluster-manager. source: [" + source + "]"));
}

/**
* called when the task was rejected because the local node is no longer cluster-manager.
* Used only for tasks submitted to {@link ClusterManagerService}.
*
* @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #onNoLongerClusterManager(String)}
*/
@Deprecated
default void onNoLongerMaster(String source) {
onNoLongerClusterManager(source);
}

/**
* Called when the result of the {@link ClusterStateTaskExecutor#execute(ClusterState, List)} have been processed
* properly by all listeners.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,6 @@ public void updateMappingOnClusterManager(Index index, Mapping mappingUpdate, Ac
}
}

/**
* Update mappings on the cluster-manager node, waiting for the change to be committed,
* but not for the mapping update to be applied on all nodes. The timeout specified by
* {@code timeout} is the cluster-manager node timeout ({@link ClusterManagerNodeRequest#clusterManagerNodeTimeout()}),
* potentially waiting for a cluster-manager node to be available.
*
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #updateMappingOnClusterManager(Index, Mapping, ActionListener)}
*/
@Deprecated
public void updateMappingOnMaster(Index index, Mapping mappingUpdate, ActionListener<Void> listener) {
updateMappingOnClusterManager(index, mappingUpdate, listener);
}

// used by tests
int blockedThreads() {
return semaphore.getQueueLength();
Expand Down
Loading
Loading