Add v6.1 BWC layer for adding wait_for_active_shards to index open command

This commit disables BWC tests while adding a v6.1 BWC layer for the PR #26682
This commit is contained in:
Yannick Welsch 2017-09-22 16:19:04 +02:00
parent a056c5d469
commit df5c450e89
6 changed files with 17 additions and 8 deletions

View File

@ -186,7 +186,7 @@ task verifyVersions {
* after the backport of the backcompat code is complete.
*/
allprojects {
ext.bwc_tests_enabled = true
ext.bwc_tests_enabled = false
}
task verifyBwcTestsEnabled {

View File

@ -141,7 +141,7 @@ public class OpenIndexRequest extends AcknowledgedRequest<OpenIndexRequest> impl
super.readFrom(in);
indices = in.readStringArray();
indicesOptions = IndicesOptions.readIndicesOptions(in);
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
if (in.getVersion().onOrAfter(Version.V_6_1_0)) {
waitForActiveShards = ActiveShardCount.readFrom(in);
}
}
@ -151,7 +151,7 @@ public class OpenIndexRequest extends AcknowledgedRequest<OpenIndexRequest> impl
super.writeTo(out);
out.writeStringArray(indices);
indicesOptions.writeIndicesOptions(out);
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
if (out.getVersion().onOrAfter(Version.V_6_1_0)) {
waitForActiveShards.writeTo(out);
}
}

View File

@ -55,7 +55,7 @@ public class OpenIndexResponse extends AcknowledgedResponse {
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
if (in.getVersion().onOrAfter(Version.V_6_1_0)) {
shardsAcknowledged = in.readBoolean();
}
}
@ -64,7 +64,7 @@ public class OpenIndexResponse extends AcknowledgedResponse {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
if (out.getVersion().onOrAfter(Version.V_6_1_0)) {
out.writeBoolean(shardsAcknowledged);
}
}

View File

@ -52,7 +52,10 @@ public class RestOpenIndexAction extends BaseRestHandler {
openIndexRequest.timeout(request.paramAsTime("timeout", openIndexRequest.timeout()));
openIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", openIndexRequest.masterNodeTimeout()));
openIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, openIndexRequest.indicesOptions()));
openIndexRequest.waitForActiveShards(ActiveShardCount.parseString(request.param("wait_for_active_shards")));
String waitForActiveShards = request.param("wait_for_active_shards");
if (waitForActiveShards != null) {
openIndexRequest.waitForActiveShards(ActiveShardCount.parseString(waitForActiveShards));
}
return channel -> client.admin().indices().open(openIndexRequest, new AcknowledgedRestListener<OpenIndexResponse>(channel) {
@Override
protected void addCustomFields(XContentBuilder builder, OpenIndexResponse response) throws IOException {

View File

@ -5,3 +5,9 @@
Due to cross-cluster search using `:` to separate a cluster and index name,
cluster names may no longer contain `:`.
==== new default for `wait_for_active_shards` parameter of the open index command
The default value for the `wait_for_active_shards` parameter of the open index API
is changed from 0 to 1, which means that the command will now by default wait for all
primary shards of the opened index to be allocated.

View File

@ -39,8 +39,8 @@
---
"Open index with wait_for_active_shards set to all":
- skip:
version: " - 6.99.99"
reason: wait_for_active_shards parameter was added in 7.0.0
version: " - 6.0.99"
reason: wait_for_active_shards parameter was added in 6.1.0
- do:
indices.create: