Add request parameter 'cluster_manager_timeout' and deprecate 'master_timeout' - in Index APIs except index template APIs (#2660)
- Deprecate the request parameter `master_timeout` that used in Index APIs which have got the parameter. (except index template APIs, which is addressed in PR https://github.com/opensearch-project/OpenSearch/pull/2678) - Add alternative new request parameter `cluster_manager_timeout`. - Add unit tests. Signed-off-by: Tianli Feng <ftianli@amazon.com>
This commit is contained in:
parent
0b1f4a2069
commit
7aa496f9dd
|
@ -135,7 +135,7 @@ public class DanglingIndicesRestIT extends HttpSmokeTestCase {
|
|||
importRequest.addParameter("accept_data_loss", "true");
|
||||
// Ensure this parameter is accepted
|
||||
importRequest.addParameter("timeout", "20s");
|
||||
importRequest.addParameter("master_timeout", "20s");
|
||||
importRequest.addParameter("cluster_manager_timeout", "20s");
|
||||
final Response importResponse = restClient.performRequest(importRequest);
|
||||
assertThat(importResponse.getStatusLine().getStatusCode(), equalTo(ACCEPTED.getStatus()));
|
||||
|
||||
|
@ -171,7 +171,7 @@ public class DanglingIndicesRestIT extends HttpSmokeTestCase {
|
|||
deleteRequest.addParameter("accept_data_loss", "true");
|
||||
// Ensure these parameters is accepted
|
||||
deleteRequest.addParameter("timeout", "20s");
|
||||
deleteRequest.addParameter("master_timeout", "20s");
|
||||
deleteRequest.addParameter("cluster_manager_timeout", "20s");
|
||||
final Response deleteResponse = restClient.performRequest(deleteRequest);
|
||||
assertThat(deleteResponse.getStatusLine().getStatusCode(), equalTo(ACCEPTED.getStatus()));
|
||||
|
||||
|
|
|
@ -32,7 +32,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description": "Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description": "Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
},
|
||||
"ignore_unavailable":{
|
||||
"type":"boolean",
|
||||
|
|
|
@ -33,7 +33,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description" : "Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
},
|
||||
"wait_for_active_shards": {
|
||||
"type" : "string",
|
||||
|
|
|
@ -28,7 +28,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
},
|
||||
"ignore_unavailable":{
|
||||
"type":"boolean",
|
||||
|
|
|
@ -32,7 +32,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
}
|
||||
},
|
||||
"body":{
|
||||
|
|
|
@ -48,7 +48,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
},
|
||||
"local":{
|
||||
"type":"boolean",
|
||||
|
|
|
@ -58,7 +58,15 @@
|
|||
"params":{
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
},
|
||||
"ignore_unavailable":{
|
||||
"type":"boolean",
|
||||
|
|
|
@ -34,7 +34,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Explicit operation timeout for connection to master node"
|
||||
"description":"Explicit operation timeout for connection to master node",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Explicit operation timeout for connection to cluster-manager node"
|
||||
},
|
||||
"local":{
|
||||
"type":"boolean",
|
||||
|
|
|
@ -50,7 +50,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
}
|
||||
},
|
||||
"body":{
|
||||
|
|
|
@ -29,7 +29,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
},
|
||||
"ignore_unavailable":{
|
||||
"type":"boolean",
|
||||
|
|
|
@ -30,7 +30,15 @@
|
|||
"params":{
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
},
|
||||
"timeout":{
|
||||
"type":"time",
|
||||
|
|
|
@ -48,7 +48,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
},
|
||||
"wait_for_active_shards":{
|
||||
"type":"string",
|
||||
|
|
|
@ -37,7 +37,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description" : "Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
},
|
||||
"wait_for_active_shards": {
|
||||
"type" : "string",
|
||||
|
|
|
@ -37,7 +37,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description" : "Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
},
|
||||
"wait_for_active_shards": {
|
||||
"type" : "string",
|
||||
|
|
|
@ -22,7 +22,15 @@
|
|||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to master"
|
||||
"description":"Specify timeout for connection to master",
|
||||
"deprecated":{
|
||||
"version":"2.0.0",
|
||||
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
|
||||
}
|
||||
},
|
||||
"cluster_manager_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to cluster-manager node"
|
||||
}
|
||||
},
|
||||
"body":{
|
||||
|
|
|
@ -31,6 +31,7 @@ setup:
|
|||
- skip:
|
||||
version: " - 7.3.99"
|
||||
reason: index cloning was added in 7.4.0
|
||||
features: allowed_warnings
|
||||
# make it read-only
|
||||
- do:
|
||||
indices.put_settings:
|
||||
|
@ -46,6 +47,8 @@ setup:
|
|||
|
||||
# now we do the actual clone
|
||||
- do:
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.clone:
|
||||
index: "source"
|
||||
target: "target"
|
||||
|
@ -94,9 +97,12 @@ setup:
|
|||
- skip:
|
||||
version: " - 7.3.99"
|
||||
reason: index cloning was added in 7.4.0
|
||||
features: allowed_warnings
|
||||
# try to do an illegal clone with illegal number_of_shards
|
||||
- do:
|
||||
catch: /illegal_argument_exception/
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.clone:
|
||||
index: "source"
|
||||
target: "target"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
- skip:
|
||||
version: " - 7.3.99"
|
||||
reason: index cloning was added in 7.4.0
|
||||
features: allowed_warnings
|
||||
# create index
|
||||
- do:
|
||||
indices.create:
|
||||
|
@ -50,6 +51,8 @@
|
|||
|
||||
# now we do the actual clone
|
||||
- do:
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.clone:
|
||||
index: "source"
|
||||
target: "target"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
- skip:
|
||||
version: " - 7.3.99"
|
||||
reason: index cloning was added in 7.4.0
|
||||
features: [arbitrary_key]
|
||||
features: [arbitrary_key, allowed_warnings]
|
||||
|
||||
- do:
|
||||
nodes.info:
|
||||
|
@ -36,6 +36,8 @@
|
|||
|
||||
# now we do an actual clone and copy settings
|
||||
- do:
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.clone:
|
||||
index: "source"
|
||||
target: "copy-settings-target"
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
# which node is the one with the highest version and that is the only one that can safely
|
||||
# be used to shrink the index.
|
||||
|
||||
- skip:
|
||||
features: allowed_warnings
|
||||
|
||||
- do:
|
||||
nodes.info:
|
||||
node_id: data:true
|
||||
|
@ -53,6 +56,8 @@
|
|||
|
||||
# now we do the actual shrink
|
||||
- do:
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.shrink:
|
||||
index: "source"
|
||||
target: "target"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
- skip:
|
||||
version: " - 6.9.99"
|
||||
reason: expects warnings that pre-7.0.0 will not send
|
||||
features: [warnings, arbitrary_key]
|
||||
features: [warnings, arbitrary_key, allowed_warnings]
|
||||
|
||||
- do:
|
||||
nodes.info:
|
||||
|
@ -60,6 +60,8 @@
|
|||
|
||||
# now we do the actual shrink
|
||||
- do:
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.shrink:
|
||||
index: "source"
|
||||
target: "target"
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
index.merge.scheduler.max_thread_count: 2
|
||||
allowed_warnings:
|
||||
- "parameter [copy_settings] is deprecated and will be removed in 8.0.0"
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
|
||||
- do:
|
||||
cluster.health:
|
||||
|
@ -64,6 +65,8 @@
|
|||
|
||||
# now we do a actual shrink and copy settings (by default)
|
||||
- do:
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.shrink:
|
||||
index: "source"
|
||||
target: "default-copy-settings-target"
|
||||
|
@ -91,6 +94,8 @@
|
|||
# now we do a actual shrink and try to set no copy settings
|
||||
- do:
|
||||
catch: /illegal_argument_exception/
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.shrink:
|
||||
index: "source"
|
||||
target: "explicit-no-copy-settings-target"
|
||||
|
|
|
@ -29,6 +29,9 @@ setup:
|
|||
|
||||
---
|
||||
"Split index via API":
|
||||
- skip:
|
||||
features: allowed_warnings
|
||||
|
||||
# make it read-only
|
||||
- do:
|
||||
indices.put_settings:
|
||||
|
@ -44,6 +47,8 @@ setup:
|
|||
|
||||
# now we do the actual split
|
||||
- do:
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.split:
|
||||
index: "source"
|
||||
target: "target"
|
||||
|
@ -90,6 +95,8 @@ setup:
|
|||
|
||||
---
|
||||
"Split from 1 to N":
|
||||
- skip:
|
||||
features: allowed_warnings
|
||||
- do:
|
||||
indices.create:
|
||||
index: source_one_shard
|
||||
|
@ -131,6 +138,8 @@ setup:
|
|||
|
||||
# now we do the actual split from 1 to 5
|
||||
- do:
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.split:
|
||||
index: "source_one_shard"
|
||||
target: "target"
|
||||
|
@ -176,9 +185,14 @@ setup:
|
|||
|
||||
---
|
||||
"Create illegal split indices":
|
||||
- skip:
|
||||
features: allowed_warnings
|
||||
|
||||
# try to do an illegal split with number_of_routing_shards set
|
||||
- do:
|
||||
catch: /illegal_argument_exception/
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.split:
|
||||
index: "source"
|
||||
target: "target"
|
||||
|
@ -193,6 +207,8 @@ setup:
|
|||
# try to do an illegal split with illegal number_of_shards
|
||||
- do:
|
||||
catch: /illegal_state_exception/
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.split:
|
||||
index: "source"
|
||||
target: "target"
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
---
|
||||
"Split index ignores target template mapping":
|
||||
- skip:
|
||||
features: allowed_warnings
|
||||
|
||||
# create index
|
||||
- do:
|
||||
indices.create:
|
||||
|
@ -48,6 +51,8 @@
|
|||
|
||||
# now we do the actual split
|
||||
- do:
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.split:
|
||||
index: "source"
|
||||
target: "target"
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
index.merge.scheduler.max_thread_count: 2
|
||||
allowed_warnings:
|
||||
- "parameter [copy_settings] is deprecated and will be removed in 8.0.0"
|
||||
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
|
||||
- do:
|
||||
cluster.health:
|
||||
|
@ -67,6 +67,8 @@
|
|||
|
||||
# now we do a actual shrink and copy settings (by default)
|
||||
- do:
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.split:
|
||||
index: "source"
|
||||
target: "default-copy-settings-target"
|
||||
|
@ -94,6 +96,8 @@
|
|||
|
||||
- do:
|
||||
catch: /illegal_argument_exception/
|
||||
allowed_warnings:
|
||||
- "Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version."
|
||||
indices.split:
|
||||
index: "source"
|
||||
target: "explicit-no-copy-settings-target"
|
||||
|
|
|
@ -35,6 +35,7 @@ package org.opensearch.rest.action.admin.cluster.dangling;
|
|||
import org.opensearch.action.admin.indices.dangling.delete.DeleteDanglingIndexRequest;
|
||||
import org.opensearch.action.support.master.AcknowledgedResponse;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
import org.opensearch.rest.RestRequest;
|
||||
import org.opensearch.rest.RestStatus;
|
||||
|
@ -49,6 +50,8 @@ import static org.opensearch.rest.RestStatus.ACCEPTED;
|
|||
|
||||
public class RestDeleteDanglingIndexAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestDeleteDanglingIndexAction.class);
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return singletonList(new Route(DELETE, "/_dangling/{index_uuid}"));
|
||||
|
@ -67,7 +70,8 @@ public class RestDeleteDanglingIndexAction extends BaseRestHandler {
|
|||
);
|
||||
|
||||
deleteRequest.timeout(request.paramAsTime("timeout", deleteRequest.timeout()));
|
||||
deleteRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteRequest.masterNodeTimeout()));
|
||||
deleteRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", deleteRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(deleteRequest, request, deprecationLogger, getName());
|
||||
|
||||
return channel -> client.admin()
|
||||
.cluster()
|
||||
|
|
|
@ -42,12 +42,15 @@ import java.util.List;
|
|||
import org.opensearch.action.admin.indices.dangling.import_index.ImportDanglingIndexRequest;
|
||||
import org.opensearch.action.support.master.AcknowledgedResponse;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
import org.opensearch.rest.RestRequest;
|
||||
import org.opensearch.rest.RestStatus;
|
||||
import org.opensearch.rest.action.RestToXContentListener;
|
||||
|
||||
public class RestImportDanglingIndexAction extends BaseRestHandler {
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestImportDanglingIndexAction.class);
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return singletonList(new Route(POST, "/_dangling/{index_uuid}"));
|
||||
|
@ -66,7 +69,8 @@ public class RestImportDanglingIndexAction extends BaseRestHandler {
|
|||
);
|
||||
|
||||
importRequest.timeout(request.paramAsTime("timeout", importRequest.timeout()));
|
||||
importRequest.masterNodeTimeout(request.paramAsTime("master_timeout", importRequest.masterNodeTimeout()));
|
||||
importRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", importRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(importRequest, request, deprecationLogger, getName());
|
||||
|
||||
return channel -> client.admin()
|
||||
.cluster()
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.opensearch.action.support.IndicesOptions;
|
|||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.cluster.metadata.IndexMetadata;
|
||||
import org.opensearch.common.Strings;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
import org.opensearch.rest.RestRequest;
|
||||
import org.opensearch.rest.action.RestToXContentListener;
|
||||
|
@ -49,6 +50,8 @@ import static org.opensearch.rest.RestRequest.Method.PUT;
|
|||
|
||||
public class RestAddIndexBlockAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestAddIndexBlockAction.class);
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return Collections.singletonList(new Route(PUT, "/{index}/_block/{block}"));
|
||||
|
@ -65,7 +68,8 @@ public class RestAddIndexBlockAction extends BaseRestHandler {
|
|||
IndexMetadata.APIBlock.fromName(request.param("block")),
|
||||
Strings.splitStringByCommaToArray(request.param("index"))
|
||||
);
|
||||
addIndexBlockRequest.masterNodeTimeout(request.paramAsTime("master_timeout", addIndexBlockRequest.masterNodeTimeout()));
|
||||
addIndexBlockRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", addIndexBlockRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(addIndexBlockRequest, request, deprecationLogger, getName());
|
||||
addIndexBlockRequest.timeout(request.paramAsTime("timeout", addIndexBlockRequest.timeout()));
|
||||
addIndexBlockRequest.indicesOptions(IndicesOptions.fromRequest(request, addIndexBlockRequest.indicesOptions()));
|
||||
return channel -> client.admin().indices().addBlock(addIndexBlockRequest, new RestToXContentListener<>(channel));
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.opensearch.action.support.ActiveShardCount;
|
|||
import org.opensearch.action.support.IndicesOptions;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.Strings;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
import org.opensearch.rest.RestRequest;
|
||||
import org.opensearch.rest.action.RestToXContentListener;
|
||||
|
@ -50,6 +51,8 @@ import static org.opensearch.rest.RestRequest.Method.POST;
|
|||
|
||||
public class RestCloseIndexAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestCloseIndexAction.class);
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return unmodifiableList(asList(new Route(POST, "/_close"), new Route(POST, "/{index}/_close")));
|
||||
|
@ -63,7 +66,8 @@ public class RestCloseIndexAction extends BaseRestHandler {
|
|||
@Override
|
||||
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
|
||||
CloseIndexRequest closeIndexRequest = new CloseIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
closeIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", closeIndexRequest.masterNodeTimeout()));
|
||||
closeIndexRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", closeIndexRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(closeIndexRequest, request, deprecationLogger, getName());
|
||||
closeIndexRequest.timeout(request.paramAsTime("timeout", closeIndexRequest.timeout()));
|
||||
closeIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, closeIndexRequest.indicesOptions()));
|
||||
String waitForActiveShards = request.param("wait_for_active_shards");
|
||||
|
|
|
@ -35,6 +35,7 @@ package org.opensearch.rest.action.admin.indices;
|
|||
import org.opensearch.action.admin.indices.create.CreateIndexRequest;
|
||||
import org.opensearch.action.support.ActiveShardCount;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
|
||||
import org.opensearch.common.xcontent.XContentHelper;
|
||||
import org.opensearch.index.mapper.MapperService;
|
||||
|
@ -53,6 +54,8 @@ import static org.opensearch.rest.RestRequest.Method.PUT;
|
|||
|
||||
public class RestCreateIndexAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestIndexPutAliasAction.class);
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return singletonList(new Route(PUT, "/{index}"));
|
||||
|
@ -74,7 +77,8 @@ public class RestCreateIndexAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
createIndexRequest.timeout(request.paramAsTime("timeout", createIndexRequest.timeout()));
|
||||
createIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", createIndexRequest.masterNodeTimeout()));
|
||||
createIndexRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", createIndexRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(createIndexRequest, request, deprecationLogger, getName());
|
||||
createIndexRequest.waitForActiveShards(ActiveShardCount.parseString(request.param("wait_for_active_shards")));
|
||||
return channel -> client.admin().indices().create(createIndexRequest, new RestToXContentListener<>(channel));
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.opensearch.action.admin.indices.delete.DeleteIndexRequest;
|
|||
import org.opensearch.action.support.IndicesOptions;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.Strings;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
import org.opensearch.rest.RestRequest;
|
||||
import org.opensearch.rest.action.RestToXContentListener;
|
||||
|
@ -49,6 +50,8 @@ import static org.opensearch.rest.RestRequest.Method.DELETE;
|
|||
|
||||
public class RestDeleteIndexAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestDeleteIndexAction.class);
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return unmodifiableList(asList(new Route(DELETE, "/"), new Route(DELETE, "/{index}")));
|
||||
|
@ -63,7 +66,8 @@ public class RestDeleteIndexAction extends BaseRestHandler {
|
|||
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
|
||||
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
deleteIndexRequest.timeout(request.paramAsTime("timeout", deleteIndexRequest.timeout()));
|
||||
deleteIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexRequest.masterNodeTimeout()));
|
||||
deleteIndexRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", deleteIndexRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(deleteIndexRequest, request, deprecationLogger, getName());
|
||||
deleteIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, deleteIndexRequest.indicesOptions()));
|
||||
return channel -> client.admin().indices().delete(deleteIndexRequest, new RestToXContentListener<>(channel));
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.opensearch.action.admin.indices.get.GetIndexRequest;
|
|||
import org.opensearch.action.support.IndicesOptions;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.Strings;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.common.settings.Settings;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
import org.opensearch.rest.RestRequest;
|
||||
|
@ -55,6 +56,8 @@ import static org.opensearch.rest.RestRequest.Method.HEAD;
|
|||
*/
|
||||
public class RestGetIndicesAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestGetIndicesAction.class);
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return unmodifiableList(asList(new Route(GET, "/{index}"), new Route(HEAD, "/{index}")));
|
||||
|
@ -72,7 +75,8 @@ public class RestGetIndicesAction extends BaseRestHandler {
|
|||
getIndexRequest.indices(indices);
|
||||
getIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, getIndexRequest.indicesOptions()));
|
||||
getIndexRequest.local(request.paramAsBoolean("local", getIndexRequest.local()));
|
||||
getIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getIndexRequest.masterNodeTimeout()));
|
||||
getIndexRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", getIndexRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(getIndexRequest, request, deprecationLogger, getName());
|
||||
getIndexRequest.humanReadable(request.paramAsBoolean("human", false));
|
||||
getIndexRequest.includeDefaults(request.paramAsBoolean("include_defaults", false));
|
||||
return channel -> client.admin().indices().getIndex(getIndexRequest, new RestToXContentListener<>(channel));
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
package org.opensearch.rest.action.admin.indices;
|
||||
|
||||
import org.opensearch.OpenSearchParseException;
|
||||
import org.opensearch.OpenSearchTimeoutException;
|
||||
import org.opensearch.action.ActionRunnable;
|
||||
import org.opensearch.action.admin.indices.mapping.get.GetMappingsRequest;
|
||||
|
@ -39,6 +40,7 @@ import org.opensearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
|||
import org.opensearch.action.support.IndicesOptions;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.Strings;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.common.unit.TimeValue;
|
||||
import org.opensearch.common.xcontent.XContentBuilder;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
|
@ -59,6 +61,12 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
|||
|
||||
public class RestGetMappingAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestGetMappingAction.class);
|
||||
private static final String MASTER_TIMEOUT_DEPRECATED_MESSAGE =
|
||||
"Deprecated parameter [master_timeout] used. To promote inclusive language, please use [cluster_manager_timeout] instead. It will be unsupported in a future major version.";
|
||||
private static final String DUPLICATE_PARAMETER_ERROR_MESSAGE =
|
||||
"Please only use one of the request parameters [master_timeout, cluster_manager_timeout].";
|
||||
|
||||
private final ThreadPool threadPool;
|
||||
|
||||
public RestGetMappingAction(ThreadPool threadPool) {
|
||||
|
@ -89,7 +97,16 @@ public class RestGetMappingAction extends BaseRestHandler {
|
|||
final GetMappingsRequest getMappingsRequest = new GetMappingsRequest();
|
||||
getMappingsRequest.indices(indices);
|
||||
getMappingsRequest.indicesOptions(IndicesOptions.fromRequest(request, getMappingsRequest.indicesOptions()));
|
||||
final TimeValue timeout = request.paramAsTime("master_timeout", getMappingsRequest.masterNodeTimeout());
|
||||
TimeValue clusterManagerTimeout = request.paramAsTime("cluster_manager_timeout", getMappingsRequest.masterNodeTimeout());
|
||||
// TODO: Remove the if condition and statements inside after removing MASTER_ROLE.
|
||||
if (request.hasParam("master_timeout")) {
|
||||
deprecationLogger.deprecate("get_mapping_master_timeout_parameter", MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
if (request.hasParam("cluster_manager_timeout")) {
|
||||
throw new OpenSearchParseException(DUPLICATE_PARAMETER_ERROR_MESSAGE);
|
||||
}
|
||||
clusterManagerTimeout = request.paramAsTime("master_timeout", getMappingsRequest.masterNodeTimeout());
|
||||
}
|
||||
final TimeValue timeout = clusterManagerTimeout;
|
||||
getMappingsRequest.masterNodeTimeout(timeout);
|
||||
getMappingsRequest.local(request.paramAsBoolean("local", getMappingsRequest.local()));
|
||||
return channel -> client.admin().indices().getMappings(getMappingsRequest, new RestActionListener<GetMappingsResponse>(channel) {
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.opensearch.action.admin.indices.settings.get.GetSettingsRequest;
|
|||
import org.opensearch.action.support.IndicesOptions;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.Strings;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
import org.opensearch.rest.RestRequest;
|
||||
import org.opensearch.rest.action.RestToXContentListener;
|
||||
|
@ -49,6 +50,8 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
|||
|
||||
public class RestGetSettingsAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestGetSettingsAction.class);
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return unmodifiableList(
|
||||
|
@ -79,7 +82,8 @@ public class RestGetSettingsAction extends BaseRestHandler {
|
|||
.includeDefaults(renderDefaults)
|
||||
.names(names);
|
||||
getSettingsRequest.local(request.paramAsBoolean("local", getSettingsRequest.local()));
|
||||
getSettingsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getSettingsRequest.masterNodeTimeout()));
|
||||
getSettingsRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", getSettingsRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(getSettingsRequest, request, deprecationLogger, getName());
|
||||
return channel -> client.admin().indices().getSettings(getSettingsRequest, new RestToXContentListener<>(channel));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.opensearch.action.admin.indices.alias.IndicesAliasesRequest;
|
|||
import org.opensearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.Strings;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
import org.opensearch.rest.RestRequest;
|
||||
import org.opensearch.rest.action.RestToXContentListener;
|
||||
|
@ -48,6 +49,8 @@ import static org.opensearch.rest.RestRequest.Method.DELETE;
|
|||
|
||||
public class RestIndexDeleteAliasesAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestIndexPutAliasAction.class);
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return unmodifiableList(asList(new Route(DELETE, "/{index}/_alias/{name}"), new Route(DELETE, "/{index}/_aliases/{name}")));
|
||||
|
@ -65,7 +68,8 @@ public class RestIndexDeleteAliasesAction extends BaseRestHandler {
|
|||
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
|
||||
indicesAliasesRequest.timeout(request.paramAsTime("timeout", indicesAliasesRequest.timeout()));
|
||||
indicesAliasesRequest.addAliasAction(AliasActions.remove().indices(indices).aliases(aliases));
|
||||
indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", indicesAliasesRequest.masterNodeTimeout()));
|
||||
indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", indicesAliasesRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(indicesAliasesRequest, request, deprecationLogger, getName());
|
||||
|
||||
return channel -> client.admin().indices().aliases(indicesAliasesRequest, new RestToXContentListener<>(channel));
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.opensearch.action.admin.indices.alias.IndicesAliasesRequest;
|
|||
import org.opensearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.Strings;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.common.xcontent.XContentParser;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
import org.opensearch.rest.RestRequest;
|
||||
|
@ -51,6 +52,8 @@ import static org.opensearch.rest.RestRequest.Method.PUT;
|
|||
|
||||
public class RestIndexPutAliasAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestIndexPutAliasAction.class);
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return unmodifiableList(
|
||||
|
@ -124,7 +127,8 @@ public class RestIndexPutAliasAction extends BaseRestHandler {
|
|||
|
||||
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
|
||||
indicesAliasesRequest.timeout(request.paramAsTime("timeout", indicesAliasesRequest.timeout()));
|
||||
indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", indicesAliasesRequest.masterNodeTimeout()));
|
||||
indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", indicesAliasesRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(indicesAliasesRequest, request, deprecationLogger, getName());
|
||||
|
||||
IndicesAliasesRequest.AliasActions aliasAction = AliasActions.add().indices(indices).alias(alias);
|
||||
if (routing != null) {
|
||||
|
|
|
@ -34,6 +34,7 @@ package org.opensearch.rest.action.admin.indices;
|
|||
|
||||
import org.opensearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.common.xcontent.XContentParser;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
import org.opensearch.rest.RestRequest;
|
||||
|
@ -47,6 +48,8 @@ import static org.opensearch.rest.RestRequest.Method.POST;
|
|||
|
||||
public class RestIndicesAliasesAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestIndicesAliasesAction.class);
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "indices_aliases_action";
|
||||
|
@ -60,7 +63,8 @@ public class RestIndicesAliasesAction extends BaseRestHandler {
|
|||
@Override
|
||||
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
|
||||
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
|
||||
indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", indicesAliasesRequest.masterNodeTimeout()));
|
||||
indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", indicesAliasesRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(indicesAliasesRequest, request, deprecationLogger, getName());
|
||||
indicesAliasesRequest.timeout(request.paramAsTime("timeout", indicesAliasesRequest.timeout()));
|
||||
try (XContentParser parser = request.contentParser()) {
|
||||
IndicesAliasesRequest.PARSER.parse(parser, indicesAliasesRequest, null);
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.opensearch.action.support.ActiveShardCount;
|
|||
import org.opensearch.action.support.IndicesOptions;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.Strings;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
import org.opensearch.rest.RestRequest;
|
||||
import org.opensearch.rest.action.RestToXContentListener;
|
||||
|
@ -50,6 +51,8 @@ import static org.opensearch.rest.RestRequest.Method.POST;
|
|||
|
||||
public class RestOpenIndexAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestOpenIndexAction.class);
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return unmodifiableList(asList(new Route(POST, "/_open"), new Route(POST, "/{index}/_open")));
|
||||
|
@ -64,7 +67,8 @@ public class RestOpenIndexAction extends BaseRestHandler {
|
|||
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
|
||||
OpenIndexRequest openIndexRequest = new OpenIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
openIndexRequest.timeout(request.paramAsTime("timeout", openIndexRequest.timeout()));
|
||||
openIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", openIndexRequest.masterNodeTimeout()));
|
||||
openIndexRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", openIndexRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(openIndexRequest, request, deprecationLogger, getName());
|
||||
openIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, openIndexRequest.indicesOptions()));
|
||||
String waitForActiveShards = request.param("wait_for_active_shards");
|
||||
if (waitForActiveShards != null) {
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.opensearch.action.admin.indices.mapping.put.PutMappingRequest;
|
|||
import org.opensearch.action.support.IndicesOptions;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.Strings;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.common.xcontent.XContentHelper;
|
||||
import org.opensearch.index.mapper.MapperService;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
|
@ -54,6 +55,8 @@ import static org.opensearch.rest.RestRequest.Method.PUT;
|
|||
|
||||
public class RestPutMappingAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestPutMappingAction.class);
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return unmodifiableList(
|
||||
|
@ -83,7 +86,8 @@ public class RestPutMappingAction extends BaseRestHandler {
|
|||
|
||||
putMappingRequest.source(sourceAsMap);
|
||||
putMappingRequest.timeout(request.paramAsTime("timeout", putMappingRequest.timeout()));
|
||||
putMappingRequest.masterNodeTimeout(request.paramAsTime("master_timeout", putMappingRequest.masterNodeTimeout()));
|
||||
putMappingRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", putMappingRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(putMappingRequest, request, deprecationLogger, getName());
|
||||
putMappingRequest.indicesOptions(IndicesOptions.fromRequest(request, putMappingRequest.indicesOptions()));
|
||||
putMappingRequest.writeIndexOnly(request.paramAsBoolean("write_index_only", false));
|
||||
return channel -> client.admin().indices().putMapping(putMappingRequest, new RestToXContentListener<>(channel));
|
||||
|
|
|
@ -91,7 +91,8 @@ public abstract class RestResizeHandler extends BaseRestHandler {
|
|||
resizeRequest.setCopySettings(copySettings);
|
||||
request.applyContentParser(resizeRequest::fromXContent);
|
||||
resizeRequest.timeout(request.paramAsTime("timeout", resizeRequest.timeout()));
|
||||
resizeRequest.masterNodeTimeout(request.paramAsTime("master_timeout", resizeRequest.masterNodeTimeout()));
|
||||
resizeRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", resizeRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(resizeRequest, request, deprecationLogger, getName());
|
||||
resizeRequest.setWaitForActiveShards(ActiveShardCount.parseString(request.param("wait_for_active_shards")));
|
||||
return channel -> client.admin().indices().resizeIndex(resizeRequest, new RestToXContentListener<>(channel));
|
||||
}
|
||||
|
|
|
@ -72,7 +72,8 @@ public class RestRolloverIndexAction extends BaseRestHandler {
|
|||
request.applyContentParser(parser -> rolloverIndexRequest.fromXContent(parser));
|
||||
rolloverIndexRequest.dryRun(request.paramAsBoolean("dry_run", false));
|
||||
rolloverIndexRequest.timeout(request.paramAsTime("timeout", rolloverIndexRequest.timeout()));
|
||||
rolloverIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", rolloverIndexRequest.masterNodeTimeout()));
|
||||
rolloverIndexRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", rolloverIndexRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(rolloverIndexRequest, request, deprecationLogger, getName());
|
||||
rolloverIndexRequest.getCreateIndexRequest()
|
||||
.waitForActiveShards(ActiveShardCount.parseString(request.param("wait_for_active_shards")));
|
||||
return channel -> client.admin().indices().rolloverIndex(rolloverIndexRequest, new RestToXContentListener<>(channel));
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.opensearch.action.admin.indices.settings.put.UpdateSettingsRequest;
|
|||
import org.opensearch.action.support.IndicesOptions;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.Strings;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.common.settings.Settings;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
import org.opensearch.rest.RestRequest;
|
||||
|
@ -52,6 +53,8 @@ import static org.opensearch.rest.RestRequest.Method.PUT;
|
|||
|
||||
public class RestUpdateSettingsAction extends BaseRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestUpdateSettingsAction.class);
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return unmodifiableList(asList(new Route(PUT, "/{index}/_settings"), new Route(PUT, "/_settings")));
|
||||
|
@ -67,7 +70,8 @@ public class RestUpdateSettingsAction extends BaseRestHandler {
|
|||
UpdateSettingsRequest updateSettingsRequest = updateSettingsRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
updateSettingsRequest.timeout(request.paramAsTime("timeout", updateSettingsRequest.timeout()));
|
||||
updateSettingsRequest.setPreserveExisting(request.paramAsBoolean("preserve_existing", updateSettingsRequest.isPreserveExisting()));
|
||||
updateSettingsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", updateSettingsRequest.masterNodeTimeout()));
|
||||
updateSettingsRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", updateSettingsRequest.masterNodeTimeout()));
|
||||
parseDeprecatedMasterTimeoutParameter(updateSettingsRequest, request, deprecationLogger, getName());
|
||||
updateSettingsRequest.indicesOptions(IndicesOptions.fromRequest(request, updateSettingsRequest.indicesOptions()));
|
||||
updateSettingsRequest.fromXContent(request.contentParser());
|
||||
|
||||
|
|
|
@ -24,6 +24,23 @@ import org.opensearch.rest.action.admin.cluster.RestClusterHealthAction;
|
|||
import org.opensearch.rest.action.admin.cluster.RestClusterRerouteAction;
|
||||
import org.opensearch.rest.action.admin.cluster.RestClusterStateAction;
|
||||
import org.opensearch.rest.action.admin.cluster.RestClusterUpdateSettingsAction;
|
||||
import org.opensearch.rest.action.admin.cluster.dangling.RestDeleteDanglingIndexAction;
|
||||
import org.opensearch.rest.action.admin.cluster.dangling.RestImportDanglingIndexAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestAddIndexBlockAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestCloseIndexAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestCreateIndexAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestDeleteIndexAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestGetIndicesAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestGetMappingAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestGetSettingsAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestIndexDeleteAliasesAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestIndexPutAliasAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestIndicesAliasesAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestOpenIndexAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestPutMappingAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestResizeHandler;
|
||||
import org.opensearch.rest.action.admin.indices.RestRolloverIndexAction;
|
||||
import org.opensearch.rest.action.admin.indices.RestUpdateSettingsAction;
|
||||
import org.opensearch.rest.action.cat.RestAllocationAction;
|
||||
import org.opensearch.rest.action.cat.RestRepositoriesAction;
|
||||
import org.opensearch.rest.action.cat.RestThreadPoolAction;
|
||||
|
@ -45,6 +62,7 @@ import java.io.IOException;
|
|||
import java.util.Collections;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.opensearch.cluster.metadata.IndexMetadata.INDEX_READ_ONLY_SETTING;
|
||||
|
||||
/**
|
||||
* As of 2.0, the request parameter 'master_timeout' in all applicable REST APIs is deprecated,
|
||||
|
@ -253,6 +271,160 @@ public class RenamedTimeoutRequestParameterTests extends OpenSearchTestCase {
|
|||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testAddIndexBlock() {
|
||||
FakeRestRequest request = new FakeRestRequest();
|
||||
request.params().put("cluster_manager_timeout", "1h");
|
||||
request.params().put("master_timeout", "3s");
|
||||
request.params().put("block", "metadata");
|
||||
NodeClient client = new NodeClient(Settings.builder().put(INDEX_READ_ONLY_SETTING.getKey(), Boolean.FALSE).build(), threadPool);
|
||||
RestAddIndexBlockAction action = new RestAddIndexBlockAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(request, client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testCloseIndex() {
|
||||
RestCloseIndexAction action = new RestCloseIndexAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testCreateIndex() {
|
||||
RestCreateIndexAction action = new RestCreateIndexAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testDeleteIndex() {
|
||||
RestDeleteIndexAction action = new RestDeleteIndexAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testGetIndices() {
|
||||
RestGetIndicesAction action = new RestGetIndicesAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testGetMapping() {
|
||||
RestGetMappingAction action = new RestGetMappingAction(threadPool);
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testGetSettings() {
|
||||
RestGetSettingsAction action = new RestGetSettingsAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testIndexDeleteAliases() {
|
||||
FakeRestRequest request = new FakeRestRequest();
|
||||
request.params().put("cluster_manager_timeout", "1h");
|
||||
request.params().put("master_timeout", "3s");
|
||||
request.params().put("name", "*");
|
||||
request.params().put("index", "test");
|
||||
RestIndexDeleteAliasesAction action = new RestIndexDeleteAliasesAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(request, client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testIndexPutAlias() {
|
||||
RestIndexPutAliasAction action = new RestIndexPutAliasAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testIndicesAliases() {
|
||||
RestIndicesAliasesAction action = new RestIndicesAliasesAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testOpenIndex() {
|
||||
RestOpenIndexAction action = new RestOpenIndexAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testPutMapping() {
|
||||
RestPutMappingAction action = new RestPutMappingAction();
|
||||
Exception e = assertThrows(
|
||||
OpenSearchParseException.class,
|
||||
() -> action.prepareRequest(getRestRequestWithBodyWithBothParams(), client)
|
||||
);
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testShrinkIndex() {
|
||||
RestResizeHandler.RestShrinkIndexAction action = new RestResizeHandler.RestShrinkIndexAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testSplitIndex() {
|
||||
RestResizeHandler.RestSplitIndexAction action = new RestResizeHandler.RestSplitIndexAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testCloneIndex() {
|
||||
RestResizeHandler.RestCloneIndexAction action = new RestResizeHandler.RestCloneIndexAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testRolloverIndex() {
|
||||
RestRolloverIndexAction action = new RestRolloverIndexAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testUpdateSettings() {
|
||||
RestUpdateSettingsAction action = new RestUpdateSettingsAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testDeleteDanglingIndex() {
|
||||
FakeRestRequest request = new FakeRestRequest();
|
||||
request.params().put("cluster_manager_timeout", "1h");
|
||||
request.params().put("master_timeout", "3s");
|
||||
request.params().put("index_uuid", "test");
|
||||
RestDeleteDanglingIndexAction action = new RestDeleteDanglingIndexAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(request, client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
public void testImportDanglingIndex() {
|
||||
FakeRestRequest request = new FakeRestRequest();
|
||||
request.params().put("cluster_manager_timeout", "1h");
|
||||
request.params().put("master_timeout", "3s");
|
||||
request.params().put("index_uuid", "test");
|
||||
RestImportDanglingIndexAction action = new RestImportDanglingIndexAction();
|
||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(request, client));
|
||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||
}
|
||||
|
||||
private MasterNodeRequest getMasterNodeRequest() {
|
||||
return new MasterNodeRequest() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue