Skip to content

Commit f63a3b5

Browse files
authored
Remove the deprecated local parameter for _cat/shards (#64867)
1 parent 329771d commit f63a3b5

File tree

5 files changed

+16
-43
lines changed

5 files changed

+16
-43
lines changed

docs/reference/cat/shards.asciidoc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,6 @@ Reason the shard is unassigned. Returned values are:
273273

274274
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=help]
275275

276-
`local`::
277-
(Optional, boolean)
278-
+
279-
deprecated::[7.11.0,"This parameter does not affect the request. It will be removed in a future release."]
280-
281276
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
282277

283278
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-s]

docs/reference/migration/migrate_8_0/api.asciidoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ Discontinue use of the `?local` query parameter. {ref}/cat-nodes.html[cat node
2424
API] requests that include this parameter will return an error.
2525
====
2626

27+
.The cat shard API's `local` query parameter has been removed.
28+
[%collapsible]
29+
====
30+
*Details* +
31+
The `?local` parameter to the `GET _cat/shards` API was deprecated in 7.x and is
32+
rejected in 8.0. This parameter caused the API to use the local cluster state
33+
to determine the nodes returned by the API rather than the cluster state from
34+
the master, but this API requests information from each selected node
35+
regardless of the `?local` parameter which means this API does not run in a
36+
fully node-local fashion.
37+
38+
*Impact* +
39+
Discontinue use of the `?local` query parameter. {ref}/cat-shards.html[cat shards
40+
API] requests that include this parameter will return an error.
41+
====
42+
2743
.The get field mapping API's `local` query parameter has been removed.
2844
[%collapsible]
2945
====

rest-api-spec/src/main/resources/rest-api-spec/api/cat.shards.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@
4949
"pb"
5050
]
5151
},
52-
"local":{
53-
"type":"boolean",
54-
"description":"Return local information, do not retrieve the state from master node (default: false)",
55-
"deprecated":{
56-
"version":"7.11.0",
57-
"description":"This parameter does not affect the request. It will be removed in a future release."
58-
}
59-
},
6052
"master_timeout":{
6153
"type":"time",
6254
"description":"Explicit operation timeout for connection to master node"

server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.elasticsearch.cluster.routing.UnassignedInfo;
3131
import org.elasticsearch.common.Strings;
3232
import org.elasticsearch.common.Table;
33-
import org.elasticsearch.common.logging.DeprecationLogger;
3433
import org.elasticsearch.common.unit.TimeValue;
3534
import org.elasticsearch.index.bulk.stats.BulkStats;
3635
import org.elasticsearch.index.cache.query.QueryCacheStats;
@@ -61,8 +60,6 @@
6160
import static org.elasticsearch.rest.RestRequest.Method.GET;
6261

6362
public class RestShardsAction extends AbstractCatAction {
64-
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(RestShardsAction.class);
65-
static final String LOCAL_DEPRECATED_MESSAGE = "The parameter [local] is deprecated and will be removed in a future release.";
6663

6764
@Override
6865
public List<Route> routes() {
@@ -90,10 +87,6 @@ protected void documentation(StringBuilder sb) {
9087
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
9188
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
9289
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
93-
if (request.hasParam("local")) {
94-
DEPRECATION_LOGGER.deprecate("local", LOCAL_DEPRECATED_MESSAGE);
95-
}
96-
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
9790
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
9891
clusterStateRequest.clear().nodes(true).routingTable(true).indices(indices);
9992
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {

server/src/test/java/org/elasticsearch/rest/action/cat/RestShardsActionTests.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.elasticsearch.action.admin.indices.stats.IndexStats;
2626
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
2727
import org.elasticsearch.action.admin.indices.stats.ShardStats;
28-
import org.elasticsearch.client.node.NodeClient;
2928
import org.elasticsearch.cluster.ClusterState;
3029
import org.elasticsearch.cluster.node.DiscoveryNode;
3130
import org.elasticsearch.cluster.node.DiscoveryNodes;
@@ -34,12 +33,9 @@
3433
import org.elasticsearch.cluster.routing.ShardRoutingState;
3534
import org.elasticsearch.cluster.routing.TestShardRouting;
3635
import org.elasticsearch.common.Table;
37-
import org.elasticsearch.common.settings.Settings;
3836
import org.elasticsearch.index.shard.ShardPath;
3937
import org.elasticsearch.test.ESTestCase;
4038
import org.elasticsearch.test.rest.FakeRestRequest;
41-
import org.elasticsearch.threadpool.TestThreadPool;
42-
import org.junit.Before;
4339

4440
import java.nio.file.Path;
4541
import java.util.ArrayList;
@@ -54,13 +50,6 @@
5450

5551
public class RestShardsActionTests extends ESTestCase {
5652

57-
private RestShardsAction action;
58-
59-
@Before
60-
public void setUpAction() {
61-
action = new RestShardsAction();
62-
}
63-
6453
public void testBuildTable() {
6554
final int numShards = randomIntBetween(1, 5);
6655
DiscoveryNode localNode = new DiscoveryNode("local", buildNewFakeTransportAddress(), Version.CURRENT);
@@ -129,16 +118,4 @@ public void testBuildTable() {
129118
assertThat(row.get(70).value, equalTo(shardStats.getStatePath()));
130119
}
131120
}
132-
133-
public void testCatNodesWithLocalDeprecationWarning() {
134-
TestThreadPool threadPool = new TestThreadPool(RestNodesActionTests.class.getName());
135-
NodeClient client = new NodeClient(Settings.EMPTY, threadPool);
136-
FakeRestRequest request = new FakeRestRequest();
137-
request.params().put("local", randomFrom("", "true", "false"));
138-
139-
action.doCatRequest(request, client);
140-
assertWarnings(RestShardsAction.LOCAL_DEPRECATED_MESSAGE);
141-
142-
terminate(threadPool);
143-
}
144121
}

0 commit comments

Comments
 (0)