Skip to content

Commit

Permalink
Deprecate public methods and variables with master term in package or…
Browse files Browse the repository at this point in the history
…g.opensearch.action.support.master

Signed-off-by: Tianli Feng <[email protected]>
  • Loading branch information
Tianli Feng committed Jun 17, 2022
1 parent 34797c6 commit 237031d
Show file tree
Hide file tree
Showing 176 changed files with 518 additions and 349 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static Request clusterPutSettings(ClusterUpdateSettingsRequest clusterUpdateSett

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(clusterUpdateSettingsRequest.timeout());
parameters.withClusterManagerTimeout(clusterUpdateSettingsRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(clusterUpdateSettingsRequest.clusterManagerNodeTimeout());
request.addParameters(parameters.asMap());
request.setEntity(RequestConverters.createEntity(clusterUpdateSettingsRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
return request;
Expand All @@ -69,7 +69,7 @@ static Request clusterGetSettings(ClusterGetSettingsRequest clusterGetSettingsRe
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withLocal(clusterGetSettingsRequest.local());
parameters.withIncludeDefaults(clusterGetSettingsRequest.includeDefaults());
parameters.withClusterManagerTimeout(clusterGetSettingsRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(clusterGetSettingsRequest.clusterManagerNodeTimeout());
request.addParameters(parameters.asMap());
return request;
}
Expand All @@ -88,7 +88,7 @@ static Request clusterHealth(ClusterHealthRequest healthRequest) {
.withWaitForNodes(healthRequest.waitForNodes())
.withWaitForEvents(healthRequest.waitForEvents())
.withTimeout(healthRequest.timeout())
.withClusterManagerTimeout(healthRequest.masterNodeTimeout())
.withClusterManagerTimeout(healthRequest.clusterManagerNodeTimeout())
.withLocal(healthRequest.local())
.withLevel(healthRequest.level());
request.addParameters(params.asMap());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static Request deleteIndex(DeleteIndexRequest deleteIndexRequest) {

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(deleteIndexRequest.timeout());
parameters.withClusterManagerTimeout(deleteIndexRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(deleteIndexRequest.clusterManagerNodeTimeout());
parameters.withIndicesOptions(deleteIndexRequest.indicesOptions());
request.addParameters(parameters.asMap());
return request;
Expand All @@ -131,7 +131,7 @@ static Request openIndex(OpenIndexRequest openIndexRequest) {

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(openIndexRequest.timeout());
parameters.withClusterManagerTimeout(openIndexRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(openIndexRequest.clusterManagerNodeTimeout());
parameters.withWaitForActiveShards(openIndexRequest.waitForActiveShards());
parameters.withIndicesOptions(openIndexRequest.indicesOptions());
request.addParameters(parameters.asMap());
Expand Down Expand Up @@ -168,7 +168,7 @@ static Request updateAliases(IndicesAliasesRequest indicesAliasesRequest) throws

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(indicesAliasesRequest.timeout());
parameters.withClusterManagerTimeout(indicesAliasesRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(indicesAliasesRequest.clusterManagerNodeTimeout());
request.addParameters(parameters.asMap());
request.setEntity(RequestConverters.createEntity(indicesAliasesRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
return request;
Expand Down Expand Up @@ -349,7 +349,7 @@ private static Request resize(org.opensearch.action.admin.indices.shrink.ResizeR

RequestConverters.Params params = new RequestConverters.Params();
params.withTimeout(resizeRequest.timeout());
params.withClusterManagerTimeout(resizeRequest.masterNodeTimeout());
params.withClusterManagerTimeout(resizeRequest.clusterManagerNodeTimeout());
params.withWaitForActiveShards(resizeRequest.getTargetIndexRequest().waitForActiveShards());
request.addParameters(params.asMap());
request.setEntity(RequestConverters.createEntity(resizeRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
Expand Down Expand Up @@ -386,7 +386,7 @@ static Request getSettings(GetSettingsRequest getSettingsRequest) {
params.withIndicesOptions(getSettingsRequest.indicesOptions());
params.withLocal(getSettingsRequest.local());
params.withIncludeDefaults(getSettingsRequest.includeDefaults());
params.withClusterManagerTimeout(getSettingsRequest.masterNodeTimeout());
params.withClusterManagerTimeout(getSettingsRequest.clusterManagerNodeTimeout());
request.addParameters(params.asMap());
return request;
}
Expand Down Expand Up @@ -429,7 +429,7 @@ static Request indexPutSettings(UpdateSettingsRequest updateSettingsRequest) thr

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(updateSettingsRequest.timeout());
parameters.withClusterManagerTimeout(updateSettingsRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(updateSettingsRequest.clusterManagerNodeTimeout());
parameters.withIndicesOptions(updateSettingsRequest.indicesOptions());
parameters.withPreserveExisting(updateSettingsRequest.isPreserveExisting());
request.addParameters(parameters.asMap());
Expand All @@ -443,7 +443,7 @@ static Request putTemplate(PutIndexTemplateRequest putIndexTemplateRequest) thro
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withClusterManagerTimeout(putIndexTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(putIndexTemplateRequest.clusterManagerNodeTimeout());
if (putIndexTemplateRequest.create()) {
params.putParam("create", Boolean.TRUE.toString());
}
Expand Down Expand Up @@ -587,7 +587,7 @@ static Request deleteTemplate(DeleteIndexTemplateRequest deleteIndexTemplateRequ
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_template").addPathPart(name).build();
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withClusterManagerTimeout(deleteIndexTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(deleteIndexTemplateRequest.clusterManagerNodeTimeout());
request.addParameters(params.asMap());
return request;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static Request getPipeline(GetPipelineRequest getPipelineRequest) {
Request request = new Request(HttpGet.METHOD_NAME, endpoint);

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withClusterManagerTimeout(getPipelineRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(getPipelineRequest.clusterManagerNodeTimeout());
request.addParameters(parameters.asMap());
return request;
}
Expand All @@ -67,7 +67,7 @@ static Request putPipeline(PutPipelineRequest putPipelineRequest) throws IOExcep

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(putPipelineRequest.timeout());
parameters.withClusterManagerTimeout(putPipelineRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(putPipelineRequest.clusterManagerNodeTimeout());
request.addParameters(parameters.asMap());
request.setEntity(RequestConverters.createEntity(putPipelineRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
return request;
Expand All @@ -81,7 +81,7 @@ static Request deletePipeline(DeletePipelineRequest deletePipelineRequest) {

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(deletePipelineRequest.timeout());
parameters.withClusterManagerTimeout(deletePipelineRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(deletePipelineRequest.clusterManagerNodeTimeout());
request.addParameters(parameters.asMap());
return request;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ static Request putScript(PutStoredScriptRequest putStoredScriptRequest) throws I
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
Params params = new Params();
params.withTimeout(putStoredScriptRequest.timeout());
params.withClusterManagerTimeout(putStoredScriptRequest.masterNodeTimeout());
params.withClusterManagerTimeout(putStoredScriptRequest.clusterManagerNodeTimeout());
if (Strings.hasText(putStoredScriptRequest.context())) {
params.putParam("context", putStoredScriptRequest.context());
}
Expand Down Expand Up @@ -757,7 +757,7 @@ static Request getScript(GetStoredScriptRequest getStoredScriptRequest) {
String endpoint = new EndpointBuilder().addPathPartAsIs("_scripts").addPathPart(getStoredScriptRequest.id()).build();
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
Params params = new Params();
params.withClusterManagerTimeout(getStoredScriptRequest.masterNodeTimeout());
params.withClusterManagerTimeout(getStoredScriptRequest.clusterManagerNodeTimeout());
request.addParameters(params.asMap());
return request;
}
Expand All @@ -767,7 +767,7 @@ static Request deleteScript(DeleteStoredScriptRequest deleteStoredScriptRequest)
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
Params params = new Params();
params.withTimeout(deleteStoredScriptRequest.timeout());
params.withClusterManagerTimeout(deleteStoredScriptRequest.masterNodeTimeout());
params.withClusterManagerTimeout(deleteStoredScriptRequest.clusterManagerNodeTimeout());
request.addParameters(params.asMap());
return request;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static Request getRepositories(GetRepositoriesRequest getRepositoriesRequest) {
Request request = new Request(HttpGet.METHOD_NAME, endpoint);

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withClusterManagerTimeout(getRepositoriesRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(getRepositoriesRequest.clusterManagerNodeTimeout());
parameters.withLocal(getRepositoriesRequest.local());
request.addParameters(parameters.asMap());
return request;
Expand All @@ -74,7 +74,7 @@ static Request createRepository(PutRepositoryRequest putRepositoryRequest) throw
Request request = new Request(HttpPut.METHOD_NAME, endpoint);

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withClusterManagerTimeout(putRepositoryRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(putRepositoryRequest.clusterManagerNodeTimeout());
parameters.withTimeout(putRepositoryRequest.timeout());
if (putRepositoryRequest.verify() == false) {
parameters.putParam("verify", "false");
Expand All @@ -91,7 +91,7 @@ static Request deleteRepository(DeleteRepositoryRequest deleteRepositoryRequest)
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withClusterManagerTimeout(deleteRepositoryRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(deleteRepositoryRequest.clusterManagerNodeTimeout());
parameters.withTimeout(deleteRepositoryRequest.timeout());
request.addParameters(parameters.asMap());
return request;
Expand All @@ -105,7 +105,7 @@ static Request verifyRepository(VerifyRepositoryRequest verifyRepositoryRequest)
Request request = new Request(HttpPost.METHOD_NAME, endpoint);

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withClusterManagerTimeout(verifyRepositoryRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(verifyRepositoryRequest.clusterManagerNodeTimeout());
parameters.withTimeout(verifyRepositoryRequest.timeout());
request.addParameters(parameters.asMap());
return request;
Expand All @@ -119,7 +119,7 @@ static Request cleanupRepository(CleanupRepositoryRequest cleanupRepositoryReque
Request request = new Request(HttpPost.METHOD_NAME, endpoint);

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withClusterManagerTimeout(cleanupRepositoryRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(cleanupRepositoryRequest.clusterManagerNodeTimeout());
parameters.withTimeout(cleanupRepositoryRequest.timeout());
request.addParameters(parameters.asMap());
return request;
Expand All @@ -132,7 +132,7 @@ static Request createSnapshot(CreateSnapshotRequest createSnapshotRequest) throw
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withClusterManagerTimeout(createSnapshotRequest.masterNodeTimeout());
params.withClusterManagerTimeout(createSnapshotRequest.clusterManagerNodeTimeout());
params.withWaitForCompletion(createSnapshotRequest.waitForCompletion());
request.addParameters(params.asMap());
request.setEntity(RequestConverters.createEntity(createSnapshotRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
Expand All @@ -148,7 +148,7 @@ static Request cloneSnapshot(CloneSnapshotRequest cloneSnapshotRequest) throws I
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withClusterManagerTimeout(cloneSnapshotRequest.masterNodeTimeout());
params.withClusterManagerTimeout(cloneSnapshotRequest.clusterManagerNodeTimeout());
request.addParameters(params.asMap());
request.setEntity(RequestConverters.createEntity(cloneSnapshotRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
return request;
Expand All @@ -167,7 +167,7 @@ static Request getSnapshots(GetSnapshotsRequest getSnapshotsRequest) {
Request request = new Request(HttpGet.METHOD_NAME, endpoint);

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withClusterManagerTimeout(getSnapshotsRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(getSnapshotsRequest.clusterManagerNodeTimeout());
parameters.putParam("ignore_unavailable", Boolean.toString(getSnapshotsRequest.ignoreUnavailable()));
parameters.putParam("verbose", Boolean.toString(getSnapshotsRequest.verbose()));
request.addParameters(parameters.asMap());
Expand All @@ -183,7 +183,7 @@ static Request snapshotsStatus(SnapshotsStatusRequest snapshotsStatusRequest) {
Request request = new Request(HttpGet.METHOD_NAME, endpoint);

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withClusterManagerTimeout(snapshotsStatusRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(snapshotsStatusRequest.clusterManagerNodeTimeout());
parameters.withIgnoreUnavailable(snapshotsStatusRequest.ignoreUnavailable());
request.addParameters(parameters.asMap());
return request;
Expand All @@ -197,7 +197,7 @@ static Request restoreSnapshot(RestoreSnapshotRequest restoreSnapshotRequest) th
.build();
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withClusterManagerTimeout(restoreSnapshotRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(restoreSnapshotRequest.clusterManagerNodeTimeout());
parameters.withWaitForCompletion(restoreSnapshotRequest.waitForCompletion());
request.addParameters(parameters.asMap());
request.setEntity(RequestConverters.createEntity(restoreSnapshotRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
Expand All @@ -212,7 +212,7 @@ static Request deleteSnapshot(DeleteSnapshotRequest deleteSnapshotRequest) {
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withClusterManagerTimeout(deleteSnapshotRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(deleteSnapshotRequest.clusterManagerNodeTimeout());
request.addParameters(parameters.asMap());
return request;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ public void testClusterHealth() {
break;
case "clusterManagerTimeout":
expectedParams.put("timeout", "30s");
healthRequest.masterNodeTimeout(clusterManagerTimeout);
healthRequest.clusterManagerNodeTimeout(clusterManagerTimeout);
expectedParams.put("cluster_manager_timeout", clusterManagerTimeout);
break;
case "both":
healthRequest.timeout(timeout);
expectedParams.put("timeout", timeout);
healthRequest.masterNodeTimeout(timeout);
healthRequest.clusterManagerNodeTimeout(timeout);
expectedParams.put("cluster_manager_timeout", timeout);
break;
case "none":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2106,7 +2106,7 @@ static void setRandomTimeoutTimeValue(Consumer<TimeValue> setter, TimeValue defa
}

static void setRandomClusterManagerTimeout(ClusterManagerNodeRequest<?> request, Map<String, String> expectedParams) {
setRandomClusterManagerTimeout(request::masterNodeTimeout, expectedParams);
setRandomClusterManagerTimeout(request::clusterManagerNodeTimeout, expectedParams);
}

static void setRandomClusterManagerTimeout(TimedRequest request, Map<String, String> expectedParams) {
Expand All @@ -2122,7 +2122,7 @@ static void setRandomClusterManagerTimeout(Consumer<String> setter, Map<String,
setter.accept(clusterManagerTimeout);
expectedParams.put("cluster_manager_timeout", clusterManagerTimeout);
} else {
expectedParams.put("cluster_manager_timeout", ClusterManagerNodeRequest.DEFAULT_MASTER_NODE_TIMEOUT.getStringRep());
expectedParams.put("cluster_manager_timeout", ClusterManagerNodeRequest.DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT.getStringRep());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public void testRestoreSnapshot() throws IOException {

if (randomBoolean()) {
String timeout = randomTimeValue();
restoreSnapshotRequest.masterNodeTimeout(timeout);
restoreSnapshotRequest.clusterManagerNodeTimeout(timeout);
expectedParams.put("cluster_manager_timeout", timeout);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void testGetStoredScript() throws Exception {
assertAcked(execute(request, highLevelClient()::putScript, highLevelClient()::putScriptAsync));

GetStoredScriptRequest getRequest = new GetStoredScriptRequest("calculate-score");
getRequest.masterNodeTimeout("50s");
getRequest.clusterManagerNodeTimeout("50s");

GetStoredScriptResponse getResponse = execute(getRequest, highLevelClient()::getScript, highLevelClient()::getScriptAsync);

Expand All @@ -83,7 +83,7 @@ public void testDeleteStoredScript() throws Exception {
assertAcked(execute(request, highLevelClient()::putScript, highLevelClient()::putScriptAsync));

DeleteStoredScriptRequest deleteRequest = new DeleteStoredScriptRequest(id);
deleteRequest.masterNodeTimeout("50s");
deleteRequest.clusterManagerNodeTimeout("50s");
deleteRequest.timeout("50s");
assertAcked(execute(deleteRequest, highLevelClient()::deleteScript, highLevelClient()::deleteScriptAsync));

Expand Down
Loading

0 comments on commit 237031d

Please sign in to comment.