Skip to content

Commit

Permalink
Rename and deprecate remaining methods in the package
Browse files Browse the repository at this point in the history
Signed-off-by: Tianli Feng <[email protected]>
  • Loading branch information
Tianli Feng committed Jun 17, 2022
1 parent 5116ed0 commit 8fc134d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static CreateIndexClusterStateUpdateRequest prepareCreateIndexRequest(
}

@Override
protected String getMasterActionName(DiscoveryNode node) {
return super.getMasterActionName(node);
protected String getClusterManagerActionName(DiscoveryNode node) {
return super.getClusterManagerActionName(node);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ protected void doStart(ClusterState clusterState) {
retryOnMasterChange(clusterState, null);
} else {
DiscoveryNode clusterManagerNode = nodes.getMasterNode();
final String actionName = getMasterActionName(clusterManagerNode);
final String actionName = getClusterManagerActionName(clusterManagerNode);
transportService.sendRequest(
clusterManagerNode,
actionName,
Expand Down Expand Up @@ -303,7 +303,7 @@ public void onTimeout(TimeValue timeout) {
* 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) {
protected String getClusterManagerActionName(DiscoveryNode node) {
return actionName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,14 @@ protected MasterNodeRequest(StreamInput in) throws IOException {
@SuppressWarnings("unchecked")
@Deprecated
public final Request masterNodeTimeout(TimeValue timeout) {
this.masterNodeTimeout = timeout;
return (Request) this;
return clusterManagerNodeTimeout(timeout);
}

/**
* A timeout value in case the cluster-manager has not been discovered yet or disconnected.
*/
@Deprecated
public final Request masterNodeTimeout(String timeout) {
return masterNodeTimeout(TimeValue.parseTimeValue(timeout, null, getClass().getSimpleName() + ".masterNodeTimeout"));
return clusterManagerNodeTimeout(timeout);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeAction;
import org.opensearch.cluster.ClusterState;
import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.io.stream.Writeable;
import org.opensearch.tasks.Task;
Expand Down Expand Up @@ -97,6 +98,15 @@ protected TransportMasterNodeAction(
*/
@Deprecated
protected void masterOperation(Task task, Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
super.clusterManagerOperation(task, request, state, listener);
clusterManagerOperation(task, request, state, listener);
}

/**
* 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
protected String getMasterActionName(DiscoveryNode node) {
return getClusterManagerActionName(node);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ public TransportClusterInfoAction(

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

@Deprecated
Expand Down

0 comments on commit 8fc134d

Please sign in to comment.