Skip to content

Commit d5f1e5c

Browse files
committed
More removal of deprecated 'master' code
Signed-off-by: Andrew Ross <[email protected]>
1 parent 0720fcc commit d5f1e5c

File tree

38 files changed

+26
-669
lines changed

38 files changed

+26
-669
lines changed

client/rest-high-level/src/main/java/org/opensearch/client/RequestConverters.java

-8
Original file line numberDiff line numberDiff line change
@@ -946,14 +946,6 @@ Params withFields(String[] fields) {
946946
return this;
947947
}
948948

949-
/**
950-
* @deprecated As of 2.0, because supporting inclusive language, replaced by {@link #withClusterManagerTimeout(TimeValue)}
951-
*/
952-
@Deprecated
953-
Params withMasterTimeout(TimeValue clusterManagerTimeout) {
954-
return putParam("master_timeout", clusterManagerTimeout);
955-
}
956-
957949
Params withClusterManagerTimeout(TimeValue clusterManagerTimeout) {
958950
return putParam("cluster_manager_timeout", clusterManagerTimeout);
959951
}

client/rest-high-level/src/main/java/org/opensearch/client/TimedRequest.java

-22
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ public abstract class TimedRequest implements Validatable {
4545

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

5249
private TimeValue timeout = DEFAULT_ACK_TIMEOUT;
5350
private TimeValue clusterManagerTimeout = DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT;
@@ -68,16 +65,6 @@ public void setClusterManagerTimeout(TimeValue clusterManagerTimeout) {
6865
this.clusterManagerTimeout = clusterManagerTimeout;
6966
}
7067

71-
/**
72-
* Sets the timeout to connect to the cluster-manager node
73-
* @param clusterManagerTimeout timeout as a {@link TimeValue}
74-
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerTimeout(TimeValue)}
75-
*/
76-
@Deprecated
77-
public void setMasterTimeout(TimeValue clusterManagerTimeout) {
78-
setClusterManagerTimeout(clusterManagerTimeout);
79-
}
80-
8168
/**
8269
* Returns the request timeout
8370
*/
@@ -91,13 +78,4 @@ public TimeValue timeout() {
9178
public TimeValue clusterManagerNodeTimeout() {
9279
return clusterManagerTimeout;
9380
}
94-
95-
/**
96-
* Returns the timeout for the request to be completed on the cluster-manager node
97-
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerNodeTimeout()}
98-
*/
99-
@Deprecated
100-
public TimeValue masterNodeTimeout() {
101-
return clusterManagerNodeTimeout();
102-
}
10381
}

client/rest-high-level/src/main/java/org/opensearch/client/indices/GetComponentTemplatesRequest.java

-21
Original file line numberDiff line numberDiff line change
@@ -71,25 +71,10 @@ public TimeValue getClusterManagerNodeTimeout() {
7171
return clusterManagerNodeTimeout;
7272
}
7373

74-
/**
75-
* @return the timeout for waiting for the cluster-manager node to respond
76-
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getMasterNodeTimeout()}
77-
*/
78-
@Deprecated
79-
public TimeValue getMasterNodeTimeout() {
80-
return getClusterManagerNodeTimeout();
81-
}
82-
8374
public void setClusterManagerNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
8475
this.clusterManagerNodeTimeout = clusterManagerNodeTimeout;
8576
}
8677

87-
/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(TimeValue)} */
88-
@Deprecated
89-
public void setMasterNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
90-
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
91-
}
92-
9378
public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
9479
final TimeValue timeValue = TimeValue.parseTimeValue(
9580
clusterManagerNodeTimeout,
@@ -98,12 +83,6 @@ public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
9883
setClusterManagerNodeTimeout(timeValue);
9984
}
10085

101-
/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(String)} */
102-
@Deprecated
103-
public void setMasterNodeTimeout(String clusterManagerNodeTimeout) {
104-
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
105-
}
106-
10786
/**
10887
* @return true if this request is to read from the local cluster state, rather than the cluster-manager node - false otherwise
10988
*/

client/rest-high-level/src/main/java/org/opensearch/client/indices/GetComposableIndexTemplateRequest.java

-21
Original file line numberDiff line numberDiff line change
@@ -71,25 +71,10 @@ public TimeValue getClusterManagerNodeTimeout() {
7171
return clusterManagerNodeTimeout;
7272
}
7373

74-
/**
75-
* @return the timeout for waiting for the cluster-manager node to respond
76-
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getMasterNodeTimeout()}
77-
*/
78-
@Deprecated
79-
public TimeValue getMasterNodeTimeout() {
80-
return getClusterManagerNodeTimeout();
81-
}
82-
8374
public void setClusterManagerNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
8475
this.clusterManagerNodeTimeout = clusterManagerNodeTimeout;
8576
}
8677

87-
/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(TimeValue)} */
88-
@Deprecated
89-
public void setMasterNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
90-
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
91-
}
92-
9378
public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
9479
final TimeValue timeValue = TimeValue.parseTimeValue(
9580
clusterManagerNodeTimeout,
@@ -98,12 +83,6 @@ public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
9883
setClusterManagerNodeTimeout(timeValue);
9984
}
10085

101-
/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(String)} */
102-
@Deprecated
103-
public void setMasterNodeTimeout(String clusterManagerNodeTimeout) {
104-
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
105-
}
106-
10786
/**
10887
* @return true if this request is to read from the local cluster state, rather than the cluster-manager node - false otherwise
10988
*/

client/rest-high-level/src/main/java/org/opensearch/client/indices/GetIndexTemplatesRequest.java

-21
Original file line numberDiff line numberDiff line change
@@ -90,25 +90,10 @@ public TimeValue getClusterManagerNodeTimeout() {
9090
return clusterManagerNodeTimeout;
9191
}
9292

93-
/**
94-
* @return the timeout for waiting for the cluster-manager node to respond
95-
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getMasterNodeTimeout()}
96-
*/
97-
@Deprecated
98-
public TimeValue getMasterNodeTimeout() {
99-
return getClusterManagerNodeTimeout();
100-
}
101-
10293
public void setClusterManagerNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
10394
this.clusterManagerNodeTimeout = clusterManagerNodeTimeout;
10495
}
10596

106-
/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(TimeValue)} */
107-
@Deprecated
108-
public void setMasterNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
109-
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
110-
}
111-
11297
public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
11398
final TimeValue timeValue = TimeValue.parseTimeValue(
11499
clusterManagerNodeTimeout,
@@ -117,12 +102,6 @@ public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
117102
setClusterManagerNodeTimeout(timeValue);
118103
}
119104

120-
/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(String)} */
121-
@Deprecated
122-
public void setMasterNodeTimeout(String clusterManagerNodeTimeout) {
123-
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
124-
}
125-
126105
/**
127106
* @return true if this request is to read from the local cluster state, rather than the cluster-manager node - false otherwise
128107
*/

client/rest/src/main/java/org/opensearch/client/Node.java

-9
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,6 @@ public boolean isClusterManagerEligible() {
226226
return roles.contains("master") || roles.contains("cluster_manager");
227227
}
228228

229-
/**
230-
* Returns whether or not the node <strong>could</strong> be elected cluster-manager.
231-
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #isClusterManagerEligible()}
232-
*/
233-
@Deprecated
234-
public boolean isMasterEligible() {
235-
return isClusterManagerEligible();
236-
}
237-
238229
/**
239230
* Returns whether or not the node stores data.
240231
*/

server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoriesIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ public void testSnapshotShardBlobDeletionRepositoryThrowingError() throws Except
433433
createFullSnapshot(repositoryName, secondSnapshot);
434434

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

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

-6
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,6 @@ public boolean hasDiscoveredClusterManager() {
367367
return clusterStateHealth.hasDiscoveredClusterManager();
368368
}
369369

370-
/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #hasDiscoveredClusterManager()} */
371-
@Deprecated
372-
public boolean hasDiscoveredMaster() {
373-
return hasDiscoveredClusterManager();
374-
}
375-
376370
public int getNumberOfPendingTasks() {
377371
return this.numberOfPendingTasks;
378372
}

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

+4-34
Original file line numberDiff line numberDiff line change
@@ -161,35 +161,16 @@ protected TransportClusterManagerNodeAction(
161161

162162
protected abstract Response read(StreamInput in) throws IOException;
163163

164-
/**
165-
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerOperation(ClusterManagerNodeRequest, ClusterState, ActionListener)}
166-
*/
167-
@Deprecated
168-
protected void masterOperation(Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
169-
throw new UnsupportedOperationException("Must be overridden");
170-
}
171-
172164
// TODO: Add abstract keyword after removing the deprecated masterOperation()
173-
protected void clusterManagerOperation(Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
174-
masterOperation(request, state, listener);
175-
}
165+
protected abstract void clusterManagerOperation(Request request, ClusterState state, ActionListener<Response> listener)
166+
throws Exception;
176167

177168
/**
178169
* Override this operation if access to the task parameter is needed
179-
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerOperation(Task, ClusterManagerNodeRequest, ClusterState, ActionListener)}
180170
*/
181-
@Deprecated
182-
protected void masterOperation(Task task, Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
183-
clusterManagerOperation(request, state, listener);
184-
}
185-
186-
/**
187-
* Override this operation if access to the task parameter is needed
188-
*/
189-
// TODO: Change the implementation to call 'clusterManagerOperation(request...)' after removing the deprecated masterOperation()
190171
protected void clusterManagerOperation(Task task, Request request, ClusterState state, ActionListener<Response> listener)
191172
throws Exception {
192-
masterOperation(task, request, state, listener);
173+
clusterManagerOperation(request, state, listener);
193174
}
194175

195176
protected boolean localExecute(Request request) {
@@ -265,7 +246,7 @@ public boolean shouldRetry(Exception e) {
265246
*/
266247
@Override
267248
public Exception getTimeoutException(Exception e) {
268-
return new ProcessClusterEventTimeoutException(request.masterNodeTimeout, actionName);
249+
return new ProcessClusterEventTimeoutException(request.clusterManagerNodeTimeout, actionName);
269250
}
270251

271252
protected void doStart(ClusterState clusterState) {
@@ -551,17 +532,6 @@ protected String getClusterManagerActionName(DiscoveryNode node) {
551532
return actionName;
552533
}
553534

554-
/**
555-
* Allows to conditionally return a different cluster-manager node action name in the case an action gets renamed.
556-
* This mainly for backwards compatibility should be used rarely
557-
*
558-
* @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #getClusterManagerActionName(DiscoveryNode)}
559-
*/
560-
@Deprecated
561-
protected String getMasterActionName(DiscoveryNode node) {
562-
return getClusterManagerActionName(node);
563-
}
564-
565535
/**
566536
* Override to true if the transport action can be executed locally and need NOT be executed always on cluster-manager (Read actions).
567537
* The action is executed locally if this method returns true AND

server/src/main/java/org/opensearch/action/support/clustermanager/info/TransportClusterInfoAction.java

+2-20
Original file line numberDiff line numberDiff line change
@@ -77,34 +77,16 @@ protected ClusterBlockException checkBlock(Request request, ClusterState state)
7777
.indicesBlockedException(ClusterBlockLevel.METADATA_READ, indexNameExpressionResolver.concreteIndexNames(state, request));
7878
}
7979

80-
/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerOperation(ClusterInfoRequest, ClusterState, ActionListener)} */
81-
@Deprecated
82-
protected final void masterOperation(final Request request, final ClusterState state, final ActionListener<Response> listener) {
83-
clusterManagerOperation(request, state, listener);
84-
}
85-
8680
@Override
8781
protected final void clusterManagerOperation(final Request request, final ClusterState state, final ActionListener<Response> listener) {
8882
String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(state, request);
8983
doClusterManagerOperation(request, concreteIndices, state, listener);
9084
}
9185

92-
// TODO: Add abstract keyword after removing the deprecated doMasterOperation()
93-
protected void doClusterManagerOperation(
86+
protected abstract void doClusterManagerOperation(
9487
Request request,
9588
String[] concreteIndices,
9689
ClusterState state,
9790
ActionListener<Response> listener
98-
) {
99-
doMasterOperation(request, concreteIndices, state, listener);
100-
}
101-
102-
/**
103-
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #doClusterManagerOperation(ClusterInfoRequest, String[], ClusterState, ActionListener)}
104-
*/
105-
@Deprecated
106-
protected void doMasterOperation(Request request, String[] concreteIndices, ClusterState state, ActionListener<Response> listener) {
107-
throw new UnsupportedOperationException("Must be overridden");
108-
}
109-
91+
);
11092
}

server/src/main/java/org/opensearch/cluster/ClusterChangedEvent.java

-10
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,6 @@ public boolean localNodeClusterManager() {
216216
return state.nodes().isLocalNodeElectedClusterManager();
217217
}
218218

219-
/**
220-
* Returns <code>true</code> iff the local node is the mater node of the cluster.
221-
*
222-
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #localNodeClusterManager()}
223-
*/
224-
@Deprecated
225-
public boolean localNodeMaster() {
226-
return localNodeClusterManager();
227-
}
228-
229219
/**
230220
* Returns the {@link org.opensearch.cluster.node.DiscoveryNodes.Delta} between
231221
* the previous cluster state and the new cluster state.

server/src/main/java/org/opensearch/cluster/ClusterStateTaskExecutor.java

-10
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,6 @@ default boolean runOnlyOnClusterManager() {
5959
return true;
6060
}
6161

62-
/**
63-
* indicates whether this executor should only run if the current node is cluster-manager
64-
*
65-
* @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #runOnlyOnClusterManager()}
66-
*/
67-
@Deprecated
68-
default boolean runOnlyOnMaster() {
69-
return runOnlyOnClusterManager();
70-
}
71-
7262
/**
7363
* Callback invoked after new cluster state is published. Note that
7464
* this method is not invoked if the cluster state was not updated.

server/src/main/java/org/opensearch/cluster/ClusterStateTaskListener.java

-11
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,6 @@ default void onNoLongerClusterManager(String source) {
5757
onFailure(source, new NotClusterManagerException("no longer cluster-manager. source: [" + source + "]"));
5858
}
5959

60-
/**
61-
* called when the task was rejected because the local node is no longer cluster-manager.
62-
* Used only for tasks submitted to {@link ClusterManagerService}.
63-
*
64-
* @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #onNoLongerClusterManager(String)}
65-
*/
66-
@Deprecated
67-
default void onNoLongerMaster(String source) {
68-
onNoLongerClusterManager(source);
69-
}
70-
7160
/**
7261
* Called when the result of the {@link ClusterStateTaskExecutor#execute(ClusterState, List)} have been processed
7362
* properly by all listeners.

server/src/main/java/org/opensearch/cluster/action/index/MappingUpdatedAction.java

-13
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,6 @@ public void updateMappingOnClusterManager(Index index, Mapping mappingUpdate, Ac
131131
}
132132
}
133133

134-
/**
135-
* Update mappings on the cluster-manager node, waiting for the change to be committed,
136-
* but not for the mapping update to be applied on all nodes. The timeout specified by
137-
* {@code timeout} is the cluster-manager node timeout ({@link ClusterManagerNodeRequest#clusterManagerNodeTimeout()}),
138-
* potentially waiting for a cluster-manager node to be available.
139-
*
140-
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #updateMappingOnClusterManager(Index, Mapping, ActionListener)}
141-
*/
142-
@Deprecated
143-
public void updateMappingOnMaster(Index index, Mapping mappingUpdate, ActionListener<Void> listener) {
144-
updateMappingOnClusterManager(index, mappingUpdate, listener);
145-
}
146-
147134
// used by tests
148135
int blockedThreads() {
149136
return semaphore.getQueueLength();

0 commit comments

Comments
 (0)