Rename request variables in shrink/split handlers (#30207)
This is a code-tidying PR, a little side adventure while working on another change. Previously only shrink request existed but when the ability to split indices was added, shrink and split were done together under a single request object: the resize request object. However, the code inherited the legacy name in the naming of some variables. This commit cleans this up.
This commit is contained in:
parent
f381e2a00c
commit
bdde2b9824
|
@ -45,12 +45,12 @@ public class RestShrinkIndexAction extends BaseRestHandler {
|
|||
|
||||
@Override
|
||||
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
|
||||
ResizeRequest shrinkIndexRequest = new ResizeRequest(request.param("target"), request.param("index"));
|
||||
shrinkIndexRequest.setResizeType(ResizeType.SHRINK);
|
||||
request.applyContentParser(shrinkIndexRequest::fromXContent);
|
||||
shrinkIndexRequest.timeout(request.paramAsTime("timeout", shrinkIndexRequest.timeout()));
|
||||
shrinkIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", shrinkIndexRequest.masterNodeTimeout()));
|
||||
shrinkIndexRequest.setWaitForActiveShards(ActiveShardCount.parseString(request.param("wait_for_active_shards")));
|
||||
return channel -> client.admin().indices().resizeIndex(shrinkIndexRequest, new RestToXContentListener<>(channel));
|
||||
final ResizeRequest resizeRequest = new ResizeRequest(request.param("target"), request.param("index"));
|
||||
resizeRequest.setResizeType(ResizeType.SHRINK);
|
||||
request.applyContentParser(resizeRequest::fromXContent);
|
||||
resizeRequest.timeout(request.paramAsTime("timeout", resizeRequest.timeout()));
|
||||
resizeRequest.masterNodeTimeout(request.paramAsTime("master_timeout", resizeRequest.masterNodeTimeout()));
|
||||
resizeRequest.setWaitForActiveShards(ActiveShardCount.parseString(request.param("wait_for_active_shards")));
|
||||
return channel -> client.admin().indices().resizeIndex(resizeRequest, new RestToXContentListener<>(channel));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ public class RestSplitIndexAction extends BaseRestHandler {
|
|||
|
||||
@Override
|
||||
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
|
||||
ResizeRequest shrinkIndexRequest = new ResizeRequest(request.param("target"), request.param("index"));
|
||||
shrinkIndexRequest.setResizeType(ResizeType.SPLIT);
|
||||
request.applyContentParser(shrinkIndexRequest::fromXContent);
|
||||
shrinkIndexRequest.timeout(request.paramAsTime("timeout", shrinkIndexRequest.timeout()));
|
||||
shrinkIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", shrinkIndexRequest.masterNodeTimeout()));
|
||||
shrinkIndexRequest.setWaitForActiveShards(ActiveShardCount.parseString(request.param("wait_for_active_shards")));
|
||||
return channel -> client.admin().indices().resizeIndex(shrinkIndexRequest, new RestToXContentListener<>(channel));
|
||||
final ResizeRequest resizeRequest = new ResizeRequest(request.param("target"), request.param("index"));
|
||||
resizeRequest.setResizeType(ResizeType.SPLIT);
|
||||
request.applyContentParser(resizeRequest::fromXContent);
|
||||
resizeRequest.timeout(request.paramAsTime("timeout", resizeRequest.timeout()));
|
||||
resizeRequest.masterNodeTimeout(request.paramAsTime("master_timeout", resizeRequest.masterNodeTimeout()));
|
||||
resizeRequest.setWaitForActiveShards(ActiveShardCount.parseString(request.param("wait_for_active_shards")));
|
||||
return channel -> client.admin().indices().resizeIndex(resizeRequest, new RestToXContentListener<>(channel));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue