Skip to content

Commit

Permalink
Rename renaming public 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 21, 2022
1 parent 6c34ae8 commit a77d350
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ public void testOneNodeShouldRunUsingPrivateIp() {

final String node1 = internalCluster().startNode(settings);
registerAzureNode(node1);
assertNotNull(client().admin().cluster().prepareState().setMasterNodeTimeout("1s").get().getState().nodes().getMasterNodeId());
assertNotNull(
client().admin().cluster().prepareState().setClusterManagerNodeTimeout("1s").get().getState().nodes().getMasterNodeId()
);

// We expect having 1 node as part of the cluster, let's test that
assertNumberOfNodes(1);
Expand All @@ -63,7 +65,9 @@ public void testOneNodeShouldRunUsingPublicIp() {

final String node1 = internalCluster().startNode(settings);
registerAzureNode(node1);
assertNotNull(client().admin().cluster().prepareState().setMasterNodeTimeout("1s").get().getState().nodes().getMasterNodeId());
assertNotNull(
client().admin().cluster().prepareState().setClusterManagerNodeTimeout("1s").get().getState().nodes().getMasterNodeId()
);

// We expect having 1 node as part of the cluster, let's test that
assertNumberOfNodes(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ public void testTwoNodesShouldRunUsingPrivateOrPublicIp() {
logger.info("--> start first node");
final String node1 = internalCluster().startNode(settings);
registerAzureNode(node1);
assertNotNull(client().admin().cluster().prepareState().setMasterNodeTimeout("1s").get().getState().nodes().getMasterNodeId());
assertNotNull(
client().admin().cluster().prepareState().setClusterManagerNodeTimeout("1s").get().getState().nodes().getMasterNodeId()
);

logger.info("--> start another node");
final String node2 = internalCluster().startNode(settings);
registerAzureNode(node2);
assertNotNull(client().admin().cluster().prepareState().setMasterNodeTimeout("1s").get().getState().nodes().getMasterNodeId());
assertNotNull(
client().admin().cluster().prepareState().setClusterManagerNodeTimeout("1s").get().getState().nodes().getMasterNodeId()
);

// We expect having 2 nodes as part of the cluster, let's test that
assertNumberOfNodes(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void testJoin() {
ClusterStateResponse clusterStateResponse = client(clusterManagerNode).admin()
.cluster()
.prepareState()
.setMasterNodeTimeout("1s")
.setClusterManagerNodeTimeout("1s")
.clear()
.setNodes(true)
.get();
Expand All @@ -104,7 +104,7 @@ public void testJoin() {
clusterStateResponse = client(secondNode).admin()
.cluster()
.prepareState()
.setMasterNodeTimeout("1s")
.setClusterManagerNodeTimeout("1s")
.clear()
.setNodes(true)
.setLocal(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void testNonLocalRequestAlwaysFindsClusterManager() throws Exception {
.prepareState()
.clear()
.setNodes(true)
.setMasterNodeTimeout("100ms");
.setClusterManagerNodeTimeout("100ms");
final ClusterStateResponse clusterStateResponse;
try {
clusterStateResponse = clusterStateRequestBuilder.get();
Expand All @@ -95,7 +95,7 @@ public void testLocalRequestAlwaysSucceeds() throws Exception {
.clear()
.setLocal(true)
.setNodes(true)
.setMasterNodeTimeout("100ms")
.setClusterManagerNodeTimeout("100ms")
.get()
.getState()
.nodes();
Expand Down Expand Up @@ -123,7 +123,7 @@ public void testNonLocalRequestAlwaysFindsClusterManagerAndWaitsForMetadata() th
.clear()
.setNodes(true)
.setMetadata(true)
.setMasterNodeTimeout(TimeValue.timeValueMillis(100))
.setClusterManagerNodeTimeout(TimeValue.timeValueMillis(100))
.setWaitForTimeOut(TimeValue.timeValueMillis(100))
.setWaitForMetadataVersion(waitForMetadataVersion);
final ClusterStateResponse clusterStateResponse;
Expand Down Expand Up @@ -156,7 +156,7 @@ public void testLocalRequestWaitsForMetadata() throws Exception {
.setLocal(true)
.setMetadata(true)
.setWaitForMetadataVersion(waitForMetadataVersion)
.setMasterNodeTimeout(TimeValue.timeValueMillis(100))
.setClusterManagerNodeTimeout(TimeValue.timeValueMillis(100))
.setWaitForTimeOut(TimeValue.timeValueMillis(100))
.get();
if (clusterStateResponse.isWaitForTimedOut() == false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void testIndexExistsWithBlocksInPlace() throws IOException {
String node = internalCluster().startNode(settings);

assertRequestBuilderThrows(
client(node).admin().indices().prepareExists("test").setMasterNodeTimeout(TimeValue.timeValueSeconds(0)),
client(node).admin().indices().prepareExists("test").setClusterManagerNodeTimeout(TimeValue.timeValueSeconds(0)),
MasterNotDiscoveredException.class
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public void testHealthOnClusterManagerFailover() throws Exception {
.prepareHealth()
.setWaitForEvents(Priority.LANGUID)
.setWaitForGreenStatus()
.setMasterNodeTimeout(TimeValue.timeValueMinutes(2))
.setClusterManagerNodeTimeout(TimeValue.timeValueMinutes(2))
.execute()
);
internalCluster().restartNode(internalCluster().getMasterName(), InternalTestCluster.EMPTY_CALLBACK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException {
client().admin()
.cluster()
.prepareState()
.setMasterNodeTimeout("100ms")
.setClusterManagerNodeTimeout("100ms")
.execute()
.actionGet()
.getState()
Expand Down Expand Up @@ -114,7 +114,7 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException {
client().admin()
.cluster()
.prepareState()
.setMasterNodeTimeout("100ms")
.setClusterManagerNodeTimeout("100ms")
.execute()
.actionGet()
.getState()
Expand Down Expand Up @@ -168,7 +168,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
client().admin()
.cluster()
.prepareState()
.setMasterNodeTimeout("100ms")
.setClusterManagerNodeTimeout("100ms")
.execute()
.actionGet()
.getState()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public void testUpdateMappingConcurrently() throws Throwable {
.endObject()
.endObject()
)
.setMasterNodeTimeout(TimeValue.timeValueMinutes(5))
.setClusterManagerNodeTimeout(TimeValue.timeValueMinutes(5))
.get();

assertThat(response.isAcknowledged(), equalTo(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ public void testDataFileCorruptionDuringRestore() throws Exception {
RestoreSnapshotResponse restoreSnapshotResponse = client.admin()
.cluster()
.prepareRestoreSnapshot("test-repo", "test-snap")
.setMasterNodeTimeout("30s")
.setClusterManagerNodeTimeout("30s")
.setWaitForCompletion(true)
.execute()
.actionGet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ public String toString() {
+ includeGlobalState
+ ", waitForCompletion="
+ waitForCompletion
+ ", masterNodeTimeout="
+ ", clusterManagerNodeTimeout="
+ clusterManagerNodeTimeout
+ ", metadata="
+ userMetadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected ClusterManagerNodeOperationRequestBuilder(OpenSearchClient client, Act
* Sets the cluster-manager node timeout in case the cluster-manager has not yet been discovered.
*/
@SuppressWarnings("unchecked")
public final RequestBuilder setMasterNodeTimeout(TimeValue timeout) {
public final RequestBuilder setClusterManagerNodeTimeout(TimeValue timeout) {
request.clusterManagerNodeTimeout(timeout);
return (RequestBuilder) this;
}
Expand All @@ -67,7 +67,7 @@ public final RequestBuilder setMasterNodeTimeout(TimeValue timeout) {
* Sets the cluster-manager node timeout in case the cluster-manager has not yet been discovered.
*/
@SuppressWarnings("unchecked")
public final RequestBuilder setMasterNodeTimeout(String timeout) {
public final RequestBuilder setClusterManagerNodeTimeout(String timeout) {
request.clusterManagerNodeTimeout(timeout);
return (RequestBuilder) this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.opensearch.action.support.clustermanager.ClusterManagerNodeOperationRequestBuilder;
import org.opensearch.action.support.clustermanager.ClusterManagerNodeRequest;
import org.opensearch.client.OpenSearchClient;
import org.opensearch.common.unit.TimeValue;

/**
* Base request builder for cluster-manager node operations
Expand All @@ -54,4 +55,22 @@ public abstract class MasterNodeOperationRequestBuilder<
protected MasterNodeOperationRequestBuilder(OpenSearchClient client, ActionType<Response> action, Request request) {
super(client, action, request);
}

/**
* Sets the cluster-manager node timeout in case the cluster-manager has not yet been discovered.
*/
@SuppressWarnings("unchecked")
@Deprecated
public final RequestBuilder setMasterNodeTimeout(TimeValue timeout) {
return setClusterManagerNodeTimeout(timeout);
}

/**
* Sets the cluster-manager node timeout in case the cluster-manager has not yet been discovered.
*/
@SuppressWarnings("unchecked")
@Deprecated
public final RequestBuilder setMasterNodeTimeout(String timeout) {
return setClusterManagerNodeTimeout(timeout);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public TransportClusterInfoAction(
super(actionName, transportService, clusterService, threadPool, actionFilters, request, indexNameExpressionResolver);
}

@Override
@Deprecated
protected final void masterOperation(final Request request, final ClusterState state, final ActionListener<Response> listener) {
clusterManagerOperation(request, state, listener);
}
Expand Down

0 comments on commit a77d350

Please sign in to comment.