Add request parameter 'cluster_manager_timeout' as the alternative for 'master_timeout', and deprecate 'master_timeout' - in CAT APIs (#2557)
Apply the change of CAT Nodes API in PR #2435 to other applicable CAT APIs. - Deprecate the request parameter `master_timeout` that used in many CAT APIs. - 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
d7d41085f8
commit
78465b4a08
|
@ -55,7 +55,15 @@
|
||||||
},
|
},
|
||||||
"master_timeout":{
|
"master_timeout":{
|
||||||
"type":"time",
|
"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"
|
||||||
},
|
},
|
||||||
"h":{
|
"h":{
|
||||||
"type":"list",
|
"type":"list",
|
||||||
|
|
|
@ -36,7 +36,15 @@
|
||||||
},
|
},
|
||||||
"master_timeout":{
|
"master_timeout":{
|
||||||
"type":"time",
|
"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"
|
||||||
},
|
},
|
||||||
"h":{
|
"h":{
|
||||||
"type":"list",
|
"type":"list",
|
||||||
|
|
|
@ -55,7 +55,15 @@
|
||||||
},
|
},
|
||||||
"master_timeout":{
|
"master_timeout":{
|
||||||
"type":"time",
|
"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"
|
||||||
},
|
},
|
||||||
"h":{
|
"h":{
|
||||||
"type":"list",
|
"type":"list",
|
||||||
|
|
|
@ -26,7 +26,15 @@
|
||||||
},
|
},
|
||||||
"master_timeout":{
|
"master_timeout":{
|
||||||
"type":"time",
|
"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"
|
||||||
},
|
},
|
||||||
"h":{
|
"h":{
|
||||||
"type":"list",
|
"type":"list",
|
||||||
|
|
|
@ -26,7 +26,15 @@
|
||||||
},
|
},
|
||||||
"master_timeout":{
|
"master_timeout":{
|
||||||
"type":"time",
|
"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"
|
||||||
},
|
},
|
||||||
"h":{
|
"h":{
|
||||||
"type":"list",
|
"type":"list",
|
||||||
|
|
|
@ -26,7 +26,15 @@
|
||||||
},
|
},
|
||||||
"master_timeout":{
|
"master_timeout":{
|
||||||
"type":"time",
|
"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"
|
||||||
},
|
},
|
||||||
"h":{
|
"h":{
|
||||||
"type":"list",
|
"type":"list",
|
||||||
|
|
|
@ -27,7 +27,15 @@
|
||||||
},
|
},
|
||||||
"master_timeout":{
|
"master_timeout":{
|
||||||
"type":"time",
|
"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"
|
||||||
},
|
},
|
||||||
"h":{
|
"h":{
|
||||||
"type":"list",
|
"type":"list",
|
||||||
|
|
|
@ -49,6 +49,18 @@
|
||||||
"pb"
|
"pb"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"master_timeout":{
|
||||||
|
"type":"time",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
"h":{
|
"h":{
|
||||||
"type":"list",
|
"type":"list",
|
||||||
"description":"Comma-separated list of column names to display"
|
"description":"Comma-separated list of column names to display"
|
||||||
|
|
|
@ -55,7 +55,15 @@
|
||||||
},
|
},
|
||||||
"master_timeout":{
|
"master_timeout":{
|
||||||
"type":"time",
|
"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"
|
||||||
},
|
},
|
||||||
"h":{
|
"h":{
|
||||||
"type":"list",
|
"type":"list",
|
||||||
|
|
|
@ -39,7 +39,15 @@
|
||||||
},
|
},
|
||||||
"master_timeout":{
|
"master_timeout":{
|
||||||
"type":"time",
|
"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"
|
||||||
},
|
},
|
||||||
"h":{
|
"h":{
|
||||||
"type":"list",
|
"type":"list",
|
||||||
|
|
|
@ -38,7 +38,15 @@
|
||||||
},
|
},
|
||||||
"master_timeout":{
|
"master_timeout":{
|
||||||
"type":"time",
|
"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"
|
||||||
},
|
},
|
||||||
"h":{
|
"h":{
|
||||||
"type":"list",
|
"type":"list",
|
||||||
|
|
|
@ -54,7 +54,15 @@
|
||||||
},
|
},
|
||||||
"master_timeout":{
|
"master_timeout":{
|
||||||
"type":"time",
|
"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"
|
||||||
},
|
},
|
||||||
"h":{
|
"h":{
|
||||||
"type":"list",
|
"type":"list",
|
||||||
|
|
|
@ -44,6 +44,7 @@ import org.opensearch.cluster.node.DiscoveryNode;
|
||||||
import org.opensearch.cluster.routing.ShardRouting;
|
import org.opensearch.cluster.routing.ShardRouting;
|
||||||
import org.opensearch.common.Strings;
|
import org.opensearch.common.Strings;
|
||||||
import org.opensearch.common.Table;
|
import org.opensearch.common.Table;
|
||||||
|
import org.opensearch.common.logging.DeprecationLogger;
|
||||||
import org.opensearch.common.unit.ByteSizeValue;
|
import org.opensearch.common.unit.ByteSizeValue;
|
||||||
import org.opensearch.rest.RestRequest;
|
import org.opensearch.rest.RestRequest;
|
||||||
import org.opensearch.rest.RestResponse;
|
import org.opensearch.rest.RestResponse;
|
||||||
|
@ -58,6 +59,8 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
||||||
|
|
||||||
public class RestAllocationAction extends AbstractCatAction {
|
public class RestAllocationAction extends AbstractCatAction {
|
||||||
|
|
||||||
|
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestAllocationAction.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Route> routes() {
|
public List<Route> routes() {
|
||||||
return unmodifiableList(asList(new Route(GET, "/_cat/allocation"), new Route(GET, "/_cat/allocation/{nodes}")));
|
return unmodifiableList(asList(new Route(GET, "/_cat/allocation"), new Route(GET, "/_cat/allocation/{nodes}")));
|
||||||
|
@ -79,7 +82,8 @@ public class RestAllocationAction extends AbstractCatAction {
|
||||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.clear().routingTable(true);
|
clusterStateRequest.clear().routingTable(true);
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
|
clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout()));
|
||||||
|
parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName());
|
||||||
|
|
||||||
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
|
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
package org.opensearch.rest.action.cat;
|
package org.opensearch.rest.action.cat;
|
||||||
|
|
||||||
|
import org.opensearch.OpenSearchParseException;
|
||||||
import org.opensearch.action.ActionListener;
|
import org.opensearch.action.ActionListener;
|
||||||
import org.opensearch.action.ActionResponse;
|
import org.opensearch.action.ActionResponse;
|
||||||
import org.opensearch.action.admin.cluster.health.ClusterHealthRequest;
|
import org.opensearch.action.admin.cluster.health.ClusterHealthRequest;
|
||||||
|
@ -52,6 +53,7 @@ import org.opensearch.cluster.health.ClusterIndexHealth;
|
||||||
import org.opensearch.cluster.metadata.IndexMetadata;
|
import org.opensearch.cluster.metadata.IndexMetadata;
|
||||||
import org.opensearch.common.Strings;
|
import org.opensearch.common.Strings;
|
||||||
import org.opensearch.common.Table;
|
import org.opensearch.common.Table;
|
||||||
|
import org.opensearch.common.logging.DeprecationLogger;
|
||||||
import org.opensearch.common.settings.Settings;
|
import org.opensearch.common.settings.Settings;
|
||||||
import org.opensearch.common.time.DateFormatter;
|
import org.opensearch.common.time.DateFormatter;
|
||||||
import org.opensearch.common.unit.TimeValue;
|
import org.opensearch.common.unit.TimeValue;
|
||||||
|
@ -82,6 +84,11 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
||||||
public class RestIndicesAction extends AbstractCatAction {
|
public class RestIndicesAction extends AbstractCatAction {
|
||||||
|
|
||||||
private static final DateFormatter STRICT_DATE_TIME_FORMATTER = DateFormatter.forPattern("strict_date_time");
|
private static final DateFormatter STRICT_DATE_TIME_FORMATTER = DateFormatter.forPattern("strict_date_time");
|
||||||
|
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestIndicesAction.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].";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Route> routes() {
|
public List<Route> routes() {
|
||||||
|
@ -109,7 +116,16 @@ public class RestIndicesAction extends AbstractCatAction {
|
||||||
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
final IndicesOptions indicesOptions = IndicesOptions.fromRequest(request, IndicesOptions.strictExpand());
|
final IndicesOptions indicesOptions = IndicesOptions.fromRequest(request, IndicesOptions.strictExpand());
|
||||||
final boolean local = request.paramAsBoolean("local", false);
|
final boolean local = request.paramAsBoolean("local", false);
|
||||||
final TimeValue masterNodeTimeout = request.paramAsTime("master_timeout", DEFAULT_MASTER_NODE_TIMEOUT);
|
TimeValue clusterManagerTimeout = request.paramAsTime("cluster_manager_timeout", DEFAULT_MASTER_NODE_TIMEOUT);
|
||||||
|
// Remove the if condition and statements inside after removing MASTER_ROLE.
|
||||||
|
if (request.hasParam("master_timeout")) {
|
||||||
|
deprecationLogger.deprecate("cat_indices_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", DEFAULT_MASTER_NODE_TIMEOUT);
|
||||||
|
}
|
||||||
|
final TimeValue clusterManagerNodeTimeout = clusterManagerTimeout;
|
||||||
final boolean includeUnloadedSegments = request.paramAsBoolean("include_unloaded_segments", false);
|
final boolean includeUnloadedSegments = request.paramAsBoolean("include_unloaded_segments", false);
|
||||||
|
|
||||||
return channel -> {
|
return channel -> {
|
||||||
|
@ -120,56 +136,66 @@ public class RestIndicesAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
sendGetSettingsRequest(indices, indicesOptions, local, masterNodeTimeout, client, new ActionListener<GetSettingsResponse>() {
|
sendGetSettingsRequest(
|
||||||
@Override
|
indices,
|
||||||
public void onResponse(final GetSettingsResponse getSettingsResponse) {
|
indicesOptions,
|
||||||
final GroupedActionListener<ActionResponse> groupedListener = createGroupedListener(request, 4, listener);
|
local,
|
||||||
groupedListener.onResponse(getSettingsResponse);
|
clusterManagerNodeTimeout,
|
||||||
|
client,
|
||||||
|
new ActionListener<GetSettingsResponse>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(final GetSettingsResponse getSettingsResponse) {
|
||||||
|
final GroupedActionListener<ActionResponse> groupedListener = createGroupedListener(request, 4, listener);
|
||||||
|
groupedListener.onResponse(getSettingsResponse);
|
||||||
|
|
||||||
// The list of indices that will be returned is determined by the indices returned from the Get Settings call.
|
// The list of indices that will be returned is determined by the indices returned from the Get Settings call.
|
||||||
// All the other requests just provide additional detail, and wildcards may be resolved differently depending on the
|
// All the other requests just provide additional detail, and wildcards may be resolved differently depending on the
|
||||||
// type of request in the presence of security plugins (looking at you, ClusterHealthRequest), so
|
// type of request in the presence of security plugins (looking at you, ClusterHealthRequest), so
|
||||||
// force the IndicesOptions for all the sub-requests to be as inclusive as possible.
|
// force the IndicesOptions for all the sub-requests to be as inclusive as possible.
|
||||||
final IndicesOptions subRequestIndicesOptions = IndicesOptions.lenientExpandHidden();
|
final IndicesOptions subRequestIndicesOptions = IndicesOptions.lenientExpandHidden();
|
||||||
|
|
||||||
// Indices that were successfully resolved during the get settings request might be deleted when the subsequent cluster
|
// Indices that were successfully resolved during the get settings request might be deleted when the subsequent
|
||||||
// state, cluster health and indices stats requests execute. We have to distinguish two cases:
|
// cluster
|
||||||
// 1) the deleted index was explicitly passed as parameter to the /_cat/indices request. In this case we want the
|
// state, cluster health and indices stats requests execute. We have to distinguish two cases:
|
||||||
// subsequent requests to fail.
|
// 1) the deleted index was explicitly passed as parameter to the /_cat/indices request. In this case we want the
|
||||||
// 2) the deleted index was resolved as part of a wildcard or _all. In this case, we want the subsequent requests not to
|
// subsequent requests to fail.
|
||||||
// fail on the deleted index (as we want to ignore wildcards that cannot be resolved).
|
// 2) the deleted index was resolved as part of a wildcard or _all. In this case, we want the subsequent requests
|
||||||
// This behavior can be ensured by letting the cluster state, cluster health and indices stats requests re-resolve the
|
// not to
|
||||||
// index names with the same indices options that we used for the initial cluster state request (strictExpand).
|
// fail on the deleted index (as we want to ignore wildcards that cannot be resolved).
|
||||||
sendIndicesStatsRequest(
|
// This behavior can be ensured by letting the cluster state, cluster health and indices stats requests re-resolve
|
||||||
indices,
|
// the
|
||||||
subRequestIndicesOptions,
|
// index names with the same indices options that we used for the initial cluster state request (strictExpand).
|
||||||
includeUnloadedSegments,
|
sendIndicesStatsRequest(
|
||||||
client,
|
indices,
|
||||||
ActionListener.wrap(groupedListener::onResponse, groupedListener::onFailure)
|
subRequestIndicesOptions,
|
||||||
);
|
includeUnloadedSegments,
|
||||||
sendClusterStateRequest(
|
client,
|
||||||
indices,
|
ActionListener.wrap(groupedListener::onResponse, groupedListener::onFailure)
|
||||||
subRequestIndicesOptions,
|
);
|
||||||
local,
|
sendClusterStateRequest(
|
||||||
masterNodeTimeout,
|
indices,
|
||||||
client,
|
subRequestIndicesOptions,
|
||||||
ActionListener.wrap(groupedListener::onResponse, groupedListener::onFailure)
|
local,
|
||||||
);
|
clusterManagerNodeTimeout,
|
||||||
sendClusterHealthRequest(
|
client,
|
||||||
indices,
|
ActionListener.wrap(groupedListener::onResponse, groupedListener::onFailure)
|
||||||
subRequestIndicesOptions,
|
);
|
||||||
local,
|
sendClusterHealthRequest(
|
||||||
masterNodeTimeout,
|
indices,
|
||||||
client,
|
subRequestIndicesOptions,
|
||||||
ActionListener.wrap(groupedListener::onResponse, groupedListener::onFailure)
|
local,
|
||||||
);
|
clusterManagerNodeTimeout,
|
||||||
|
client,
|
||||||
|
ActionListener.wrap(groupedListener::onResponse, groupedListener::onFailure)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(final Exception e) {
|
||||||
|
listener.onFailure(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
);
|
||||||
@Override
|
|
||||||
public void onFailure(final Exception e) {
|
|
||||||
listener.onFailure(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.opensearch.client.node.NodeClient;
|
||||||
import org.opensearch.cluster.node.DiscoveryNode;
|
import org.opensearch.cluster.node.DiscoveryNode;
|
||||||
import org.opensearch.cluster.node.DiscoveryNodes;
|
import org.opensearch.cluster.node.DiscoveryNodes;
|
||||||
import org.opensearch.common.Table;
|
import org.opensearch.common.Table;
|
||||||
|
import org.opensearch.common.logging.DeprecationLogger;
|
||||||
import org.opensearch.rest.RestRequest;
|
import org.opensearch.rest.RestRequest;
|
||||||
import org.opensearch.rest.RestResponse;
|
import org.opensearch.rest.RestResponse;
|
||||||
import org.opensearch.rest.action.RestResponseListener;
|
import org.opensearch.rest.action.RestResponseListener;
|
||||||
|
@ -49,6 +50,8 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
||||||
|
|
||||||
public class RestMasterAction extends AbstractCatAction {
|
public class RestMasterAction extends AbstractCatAction {
|
||||||
|
|
||||||
|
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestMasterAction.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ReplacedRoute> replacedRoutes() {
|
public List<ReplacedRoute> replacedRoutes() {
|
||||||
// The deprecated path will be removed in a future major version.
|
// The deprecated path will be removed in a future major version.
|
||||||
|
@ -70,7 +73,8 @@ public class RestMasterAction extends AbstractCatAction {
|
||||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.clear().nodes(true);
|
clusterStateRequest.clear().nodes(true);
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
|
clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout()));
|
||||||
|
parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName());
|
||||||
|
|
||||||
return channel -> client.admin().cluster().state(clusterStateRequest, new RestResponseListener<ClusterStateResponse>(channel) {
|
return channel -> client.admin().cluster().state(clusterStateRequest, new RestResponseListener<ClusterStateResponse>(channel) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.opensearch.cluster.node.DiscoveryNode;
|
||||||
import org.opensearch.cluster.node.DiscoveryNodes;
|
import org.opensearch.cluster.node.DiscoveryNodes;
|
||||||
import org.opensearch.common.Strings;
|
import org.opensearch.common.Strings;
|
||||||
import org.opensearch.common.Table;
|
import org.opensearch.common.Table;
|
||||||
|
import org.opensearch.common.logging.DeprecationLogger;
|
||||||
import org.opensearch.monitor.process.ProcessInfo;
|
import org.opensearch.monitor.process.ProcessInfo;
|
||||||
import org.opensearch.rest.RestRequest;
|
import org.opensearch.rest.RestRequest;
|
||||||
import org.opensearch.rest.RestResponse;
|
import org.opensearch.rest.RestResponse;
|
||||||
|
@ -56,6 +57,8 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
||||||
|
|
||||||
public class RestNodeAttrsAction extends AbstractCatAction {
|
public class RestNodeAttrsAction extends AbstractCatAction {
|
||||||
|
|
||||||
|
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestNodeAttrsAction.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Route> routes() {
|
public List<Route> routes() {
|
||||||
return singletonList(new Route(GET, "/_cat/nodeattrs"));
|
return singletonList(new Route(GET, "/_cat/nodeattrs"));
|
||||||
|
@ -76,7 +79,8 @@ public class RestNodeAttrsAction extends AbstractCatAction {
|
||||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.clear().nodes(true);
|
clusterStateRequest.clear().nodes(true);
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
|
clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout()));
|
||||||
|
parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName());
|
||||||
|
|
||||||
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
|
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.opensearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
|
||||||
import org.opensearch.client.node.NodeClient;
|
import org.opensearch.client.node.NodeClient;
|
||||||
import org.opensearch.cluster.service.PendingClusterTask;
|
import org.opensearch.cluster.service.PendingClusterTask;
|
||||||
import org.opensearch.common.Table;
|
import org.opensearch.common.Table;
|
||||||
|
import org.opensearch.common.logging.DeprecationLogger;
|
||||||
import org.opensearch.rest.RestRequest;
|
import org.opensearch.rest.RestRequest;
|
||||||
import org.opensearch.rest.RestResponse;
|
import org.opensearch.rest.RestResponse;
|
||||||
import org.opensearch.rest.action.RestResponseListener;
|
import org.opensearch.rest.action.RestResponseListener;
|
||||||
|
@ -48,6 +49,8 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
||||||
|
|
||||||
public class RestPendingClusterTasksAction extends AbstractCatAction {
|
public class RestPendingClusterTasksAction extends AbstractCatAction {
|
||||||
|
|
||||||
|
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestPendingClusterTasksAction.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Route> routes() {
|
public List<Route> routes() {
|
||||||
return singletonList(new Route(GET, "/_cat/pending_tasks"));
|
return singletonList(new Route(GET, "/_cat/pending_tasks"));
|
||||||
|
@ -66,7 +69,10 @@ public class RestPendingClusterTasksAction extends AbstractCatAction {
|
||||||
@Override
|
@Override
|
||||||
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
|
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
|
||||||
PendingClusterTasksRequest pendingClusterTasksRequest = new PendingClusterTasksRequest();
|
PendingClusterTasksRequest pendingClusterTasksRequest = new PendingClusterTasksRequest();
|
||||||
pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout()));
|
pendingClusterTasksRequest.masterNodeTimeout(
|
||||||
|
request.paramAsTime("cluster_manager_timeout", pendingClusterTasksRequest.masterNodeTimeout())
|
||||||
|
);
|
||||||
|
parseDeprecatedMasterTimeoutParameter(pendingClusterTasksRequest, request, deprecationLogger, getName());
|
||||||
pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));
|
pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));
|
||||||
return channel -> client.admin()
|
return channel -> client.admin()
|
||||||
.cluster()
|
.cluster()
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.opensearch.client.node.NodeClient;
|
||||||
import org.opensearch.cluster.node.DiscoveryNode;
|
import org.opensearch.cluster.node.DiscoveryNode;
|
||||||
import org.opensearch.cluster.node.DiscoveryNodes;
|
import org.opensearch.cluster.node.DiscoveryNodes;
|
||||||
import org.opensearch.common.Table;
|
import org.opensearch.common.Table;
|
||||||
|
import org.opensearch.common.logging.DeprecationLogger;
|
||||||
import org.opensearch.plugins.PluginInfo;
|
import org.opensearch.plugins.PluginInfo;
|
||||||
import org.opensearch.rest.RestRequest;
|
import org.opensearch.rest.RestRequest;
|
||||||
import org.opensearch.rest.RestResponse;
|
import org.opensearch.rest.RestResponse;
|
||||||
|
@ -55,6 +56,8 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
||||||
|
|
||||||
public class RestPluginsAction extends AbstractCatAction {
|
public class RestPluginsAction extends AbstractCatAction {
|
||||||
|
|
||||||
|
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestPluginsAction.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Route> routes() {
|
public List<Route> routes() {
|
||||||
return singletonList(new Route(GET, "/_cat/plugins"));
|
return singletonList(new Route(GET, "/_cat/plugins"));
|
||||||
|
@ -75,7 +78,8 @@ public class RestPluginsAction extends AbstractCatAction {
|
||||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.clear().nodes(true);
|
clusterStateRequest.clear().nodes(true);
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
|
clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout()));
|
||||||
|
parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName());
|
||||||
|
|
||||||
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
|
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.opensearch.action.admin.cluster.repositories.get.GetRepositoriesRespo
|
||||||
import org.opensearch.client.node.NodeClient;
|
import org.opensearch.client.node.NodeClient;
|
||||||
import org.opensearch.cluster.metadata.RepositoryMetadata;
|
import org.opensearch.cluster.metadata.RepositoryMetadata;
|
||||||
import org.opensearch.common.Table;
|
import org.opensearch.common.Table;
|
||||||
|
import org.opensearch.common.logging.DeprecationLogger;
|
||||||
import org.opensearch.rest.RestRequest;
|
import org.opensearch.rest.RestRequest;
|
||||||
import org.opensearch.rest.RestResponse;
|
import org.opensearch.rest.RestResponse;
|
||||||
import org.opensearch.rest.action.RestResponseListener;
|
import org.opensearch.rest.action.RestResponseListener;
|
||||||
|
@ -51,16 +52,21 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
||||||
*/
|
*/
|
||||||
public class RestRepositoriesAction extends AbstractCatAction {
|
public class RestRepositoriesAction extends AbstractCatAction {
|
||||||
|
|
||||||
|
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestRepositoriesAction.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Route> routes() {
|
public List<Route> routes() {
|
||||||
return singletonList(new Route(GET, "/_cat/repositories"));
|
return singletonList(new Route(GET, "/_cat/repositories"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RestChannelConsumer doCatRequest(RestRequest request, NodeClient client) {
|
public RestChannelConsumer doCatRequest(RestRequest request, NodeClient client) {
|
||||||
GetRepositoriesRequest getRepositoriesRequest = new GetRepositoriesRequest();
|
GetRepositoriesRequest getRepositoriesRequest = new GetRepositoriesRequest();
|
||||||
getRepositoriesRequest.local(request.paramAsBoolean("local", getRepositoriesRequest.local()));
|
getRepositoriesRequest.local(request.paramAsBoolean("local", getRepositoriesRequest.local()));
|
||||||
getRepositoriesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getRepositoriesRequest.masterNodeTimeout()));
|
getRepositoriesRequest.masterNodeTimeout(
|
||||||
|
request.paramAsTime("cluster_manager_timeout", getRepositoriesRequest.masterNodeTimeout())
|
||||||
|
);
|
||||||
|
parseDeprecatedMasterTimeoutParameter(getRepositoriesRequest, request, deprecationLogger, getName());
|
||||||
|
|
||||||
return channel -> client.admin()
|
return channel -> client.admin()
|
||||||
.cluster()
|
.cluster()
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.opensearch.client.node.NodeClient;
|
||||||
import org.opensearch.cluster.node.DiscoveryNodes;
|
import org.opensearch.cluster.node.DiscoveryNodes;
|
||||||
import org.opensearch.common.Strings;
|
import org.opensearch.common.Strings;
|
||||||
import org.opensearch.common.Table;
|
import org.opensearch.common.Table;
|
||||||
|
import org.opensearch.common.logging.DeprecationLogger;
|
||||||
import org.opensearch.index.engine.Segment;
|
import org.opensearch.index.engine.Segment;
|
||||||
import org.opensearch.rest.RestRequest;
|
import org.opensearch.rest.RestRequest;
|
||||||
import org.opensearch.rest.RestResponse;
|
import org.opensearch.rest.RestResponse;
|
||||||
|
@ -58,6 +59,8 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
||||||
|
|
||||||
public class RestSegmentsAction extends AbstractCatAction {
|
public class RestSegmentsAction extends AbstractCatAction {
|
||||||
|
|
||||||
|
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestSegmentsAction.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Route> routes() {
|
public List<Route> routes() {
|
||||||
return unmodifiableList(asList(new Route(GET, "/_cat/segments"), new Route(GET, "/_cat/segments/{index}")));
|
return unmodifiableList(asList(new Route(GET, "/_cat/segments"), new Route(GET, "/_cat/segments/{index}")));
|
||||||
|
@ -74,12 +77,13 @@ public class RestSegmentsAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
|
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
|
||||||
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
|
|
||||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
|
clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout()));
|
||||||
|
parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName());
|
||||||
clusterStateRequest.clear().nodes(true).routingTable(true).indices(indices);
|
clusterStateRequest.clear().nodes(true).routingTable(true).indices(indices);
|
||||||
|
|
||||||
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
|
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.opensearch.cluster.routing.ShardRouting;
|
||||||
import org.opensearch.cluster.routing.UnassignedInfo;
|
import org.opensearch.cluster.routing.UnassignedInfo;
|
||||||
import org.opensearch.common.Strings;
|
import org.opensearch.common.Strings;
|
||||||
import org.opensearch.common.Table;
|
import org.opensearch.common.Table;
|
||||||
|
import org.opensearch.common.logging.DeprecationLogger;
|
||||||
import org.opensearch.common.unit.TimeValue;
|
import org.opensearch.common.unit.TimeValue;
|
||||||
import org.opensearch.index.cache.query.QueryCacheStats;
|
import org.opensearch.index.cache.query.QueryCacheStats;
|
||||||
import org.opensearch.index.engine.CommitStats;
|
import org.opensearch.index.engine.CommitStats;
|
||||||
|
@ -75,6 +76,8 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
||||||
|
|
||||||
public class RestShardsAction extends AbstractCatAction {
|
public class RestShardsAction extends AbstractCatAction {
|
||||||
|
|
||||||
|
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestShardsAction.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Route> routes() {
|
public List<Route> routes() {
|
||||||
return unmodifiableList(asList(new Route(GET, "/_cat/shards"), new Route(GET, "/_cat/shards/{index}")));
|
return unmodifiableList(asList(new Route(GET, "/_cat/shards"), new Route(GET, "/_cat/shards/{index}")));
|
||||||
|
@ -101,7 +104,8 @@ public class RestShardsAction extends AbstractCatAction {
|
||||||
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
|
clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout()));
|
||||||
|
parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName());
|
||||||
clusterStateRequest.clear().nodes(true).routingTable(true).indices(indices);
|
clusterStateRequest.clear().nodes(true).routingTable(true).indices(indices);
|
||||||
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
|
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.opensearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
|
||||||
import org.opensearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
import org.opensearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
||||||
import org.opensearch.client.node.NodeClient;
|
import org.opensearch.client.node.NodeClient;
|
||||||
import org.opensearch.common.Table;
|
import org.opensearch.common.Table;
|
||||||
|
import org.opensearch.common.logging.DeprecationLogger;
|
||||||
import org.opensearch.common.time.DateFormatter;
|
import org.opensearch.common.time.DateFormatter;
|
||||||
import org.opensearch.common.unit.TimeValue;
|
import org.opensearch.common.unit.TimeValue;
|
||||||
import org.opensearch.rest.RestRequest;
|
import org.opensearch.rest.RestRequest;
|
||||||
|
@ -58,6 +59,8 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
||||||
*/
|
*/
|
||||||
public class RestSnapshotAction extends AbstractCatAction {
|
public class RestSnapshotAction extends AbstractCatAction {
|
||||||
|
|
||||||
|
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestSnapshotAction.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Route> routes() {
|
public List<Route> routes() {
|
||||||
return unmodifiableList(asList(new Route(GET, "/_cat/snapshots"), new Route(GET, "/_cat/snapshots/{repository}")));
|
return unmodifiableList(asList(new Route(GET, "/_cat/snapshots"), new Route(GET, "/_cat/snapshots/{repository}")));
|
||||||
|
@ -69,13 +72,14 @@ public class RestSnapshotAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RestChannelConsumer doCatRequest(final RestRequest request, NodeClient client) {
|
public RestChannelConsumer doCatRequest(final RestRequest request, NodeClient client) {
|
||||||
GetSnapshotsRequest getSnapshotsRequest = new GetSnapshotsRequest().repository(request.param("repository"))
|
GetSnapshotsRequest getSnapshotsRequest = new GetSnapshotsRequest().repository(request.param("repository"))
|
||||||
.snapshots(new String[] { GetSnapshotsRequest.ALL_SNAPSHOTS });
|
.snapshots(new String[] { GetSnapshotsRequest.ALL_SNAPSHOTS });
|
||||||
|
|
||||||
getSnapshotsRequest.ignoreUnavailable(request.paramAsBoolean("ignore_unavailable", getSnapshotsRequest.ignoreUnavailable()));
|
getSnapshotsRequest.ignoreUnavailable(request.paramAsBoolean("ignore_unavailable", getSnapshotsRequest.ignoreUnavailable()));
|
||||||
|
|
||||||
getSnapshotsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getSnapshotsRequest.masterNodeTimeout()));
|
getSnapshotsRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", getSnapshotsRequest.masterNodeTimeout()));
|
||||||
|
parseDeprecatedMasterTimeoutParameter(getSnapshotsRequest, request, deprecationLogger, getName());
|
||||||
|
|
||||||
return channel -> client.admin()
|
return channel -> client.admin()
|
||||||
.cluster()
|
.cluster()
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.opensearch.cluster.metadata.IndexTemplateMetadata;
|
||||||
import org.opensearch.cluster.metadata.ComposableIndexTemplate;
|
import org.opensearch.cluster.metadata.ComposableIndexTemplate;
|
||||||
import org.opensearch.cluster.metadata.Metadata;
|
import org.opensearch.cluster.metadata.Metadata;
|
||||||
import org.opensearch.common.Table;
|
import org.opensearch.common.Table;
|
||||||
|
import org.opensearch.common.logging.DeprecationLogger;
|
||||||
import org.opensearch.common.regex.Regex;
|
import org.opensearch.common.regex.Regex;
|
||||||
import org.opensearch.rest.RestRequest;
|
import org.opensearch.rest.RestRequest;
|
||||||
import org.opensearch.rest.RestResponse;
|
import org.opensearch.rest.RestResponse;
|
||||||
|
@ -54,6 +55,8 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
||||||
|
|
||||||
public class RestTemplatesAction extends AbstractCatAction {
|
public class RestTemplatesAction extends AbstractCatAction {
|
||||||
|
|
||||||
|
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestTemplatesAction.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Route> routes() {
|
public List<Route> routes() {
|
||||||
return unmodifiableList(asList(new Route(GET, "/_cat/templates"), new Route(GET, "/_cat/templates/{name}")));
|
return unmodifiableList(asList(new Route(GET, "/_cat/templates"), new Route(GET, "/_cat/templates/{name}")));
|
||||||
|
@ -70,12 +73,13 @@ public class RestTemplatesAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RestChannelConsumer doCatRequest(final RestRequest request, NodeClient client) {
|
public RestChannelConsumer doCatRequest(final RestRequest request, NodeClient client) {
|
||||||
final String matchPattern = request.hasParam("name") ? request.param("name") : null;
|
final String matchPattern = request.hasParam("name") ? request.param("name") : null;
|
||||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.clear().metadata(true);
|
clusterStateRequest.clear().metadata(true);
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
|
clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout()));
|
||||||
|
parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName());
|
||||||
|
|
||||||
return channel -> client.admin().cluster().state(clusterStateRequest, new RestResponseListener<ClusterStateResponse>(channel) {
|
return channel -> client.admin().cluster().state(clusterStateRequest, new RestResponseListener<ClusterStateResponse>(channel) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -44,6 +44,7 @@ import org.opensearch.client.node.NodeClient;
|
||||||
import org.opensearch.cluster.node.DiscoveryNode;
|
import org.opensearch.cluster.node.DiscoveryNode;
|
||||||
import org.opensearch.cluster.node.DiscoveryNodes;
|
import org.opensearch.cluster.node.DiscoveryNodes;
|
||||||
import org.opensearch.common.Table;
|
import org.opensearch.common.Table;
|
||||||
|
import org.opensearch.common.logging.DeprecationLogger;
|
||||||
import org.opensearch.common.regex.Regex;
|
import org.opensearch.common.regex.Regex;
|
||||||
import org.opensearch.monitor.process.ProcessInfo;
|
import org.opensearch.monitor.process.ProcessInfo;
|
||||||
import org.opensearch.rest.RestRequest;
|
import org.opensearch.rest.RestRequest;
|
||||||
|
@ -68,6 +69,8 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
||||||
|
|
||||||
public class RestThreadPoolAction extends AbstractCatAction {
|
public class RestThreadPoolAction extends AbstractCatAction {
|
||||||
|
|
||||||
|
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestThreadPoolAction.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Route> routes() {
|
public List<Route> routes() {
|
||||||
return unmodifiableList(asList(new Route(GET, "/_cat/thread_pool"), new Route(GET, "/_cat/thread_pool/{thread_pool_patterns}")));
|
return unmodifiableList(asList(new Route(GET, "/_cat/thread_pool"), new Route(GET, "/_cat/thread_pool/{thread_pool_patterns}")));
|
||||||
|
@ -89,7 +92,8 @@ public class RestThreadPoolAction extends AbstractCatAction {
|
||||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.clear().nodes(true);
|
clusterStateRequest.clear().nodes(true);
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
|
clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout()));
|
||||||
|
parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName());
|
||||||
|
|
||||||
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
|
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,6 +14,19 @@ import org.opensearch.action.support.master.MasterNodeRequest;
|
||||||
import org.opensearch.client.node.NodeClient;
|
import org.opensearch.client.node.NodeClient;
|
||||||
import org.opensearch.common.logging.DeprecationLogger;
|
import org.opensearch.common.logging.DeprecationLogger;
|
||||||
import org.opensearch.common.settings.Settings;
|
import org.opensearch.common.settings.Settings;
|
||||||
|
import org.opensearch.rest.action.cat.RestAllocationAction;
|
||||||
|
import org.opensearch.rest.action.cat.RestRepositoriesAction;
|
||||||
|
import org.opensearch.rest.action.cat.RestThreadPoolAction;
|
||||||
|
import org.opensearch.rest.action.cat.RestMasterAction;
|
||||||
|
import org.opensearch.rest.action.cat.RestShardsAction;
|
||||||
|
import org.opensearch.rest.action.cat.RestPluginsAction;
|
||||||
|
import org.opensearch.rest.action.cat.RestNodeAttrsAction;
|
||||||
|
import org.opensearch.rest.action.cat.RestNodesAction;
|
||||||
|
import org.opensearch.rest.action.cat.RestIndicesAction;
|
||||||
|
import org.opensearch.rest.action.cat.RestTemplatesAction;
|
||||||
|
import org.opensearch.rest.action.cat.RestPendingClusterTasksAction;
|
||||||
|
import org.opensearch.rest.action.cat.RestSegmentsAction;
|
||||||
|
import org.opensearch.rest.action.cat.RestSnapshotAction;
|
||||||
import org.opensearch.rest.BaseRestHandler;
|
import org.opensearch.rest.BaseRestHandler;
|
||||||
import org.opensearch.rest.action.cat.RestNodesAction;
|
import org.opensearch.rest.action.cat.RestNodesAction;
|
||||||
import org.opensearch.test.OpenSearchTestCase;
|
import org.opensearch.test.OpenSearchTestCase;
|
||||||
|
@ -77,12 +90,96 @@ public class RenamedTimeoutRequestParameterTests extends OpenSearchTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCatAllocation() {
|
public void testCatAllocation() {
|
||||||
|
RestAllocationAction action = new RestAllocationAction();
|
||||||
|
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
||||||
|
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||||
|
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCatIndices() {
|
||||||
|
RestIndicesAction action = new RestIndicesAction();
|
||||||
|
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
||||||
|
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||||
|
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCatClusterManager() {
|
||||||
|
RestMasterAction action = new RestMasterAction();
|
||||||
|
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
||||||
|
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||||
|
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCatNodeattrs() {
|
||||||
|
RestNodeAttrsAction action = new RestNodeAttrsAction();
|
||||||
|
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
||||||
|
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||||
|
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCatNodes() {
|
||||||
RestNodesAction action = new RestNodesAction();
|
RestNodesAction action = new RestNodesAction();
|
||||||
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
||||||
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||||
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testCatPendingTasks() {
|
||||||
|
RestPendingClusterTasksAction action = new RestPendingClusterTasksAction();
|
||||||
|
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
||||||
|
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||||
|
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCatPlugins() {
|
||||||
|
RestPluginsAction action = new RestPluginsAction();
|
||||||
|
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
||||||
|
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||||
|
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCatRepositories() {
|
||||||
|
RestRepositoriesAction action = new RestRepositoriesAction();
|
||||||
|
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
||||||
|
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||||
|
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCatShards() {
|
||||||
|
RestShardsAction action = new RestShardsAction();
|
||||||
|
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
||||||
|
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||||
|
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCatSnapshots() {
|
||||||
|
RestSnapshotAction action = new RestSnapshotAction();
|
||||||
|
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
||||||
|
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||||
|
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCatTemplates() {
|
||||||
|
RestTemplatesAction action = new RestTemplatesAction();
|
||||||
|
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
||||||
|
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||||
|
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCatThreadPool() {
|
||||||
|
RestThreadPoolAction action = new RestThreadPoolAction();
|
||||||
|
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
||||||
|
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||||
|
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCatSegments() {
|
||||||
|
RestSegmentsAction action = new RestSegmentsAction();
|
||||||
|
Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client));
|
||||||
|
assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE));
|
||||||
|
assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
private MasterNodeRequest getMasterNodeRequest() {
|
private MasterNodeRequest getMasterNodeRequest() {
|
||||||
return new MasterNodeRequest() {
|
return new MasterNodeRequest() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue