浏览代码

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
Yannick Welsch 8 年之前
父节点
当前提交
df5c450e89

+ 1 - 1
build.gradle

@@ -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 {

+ 2 - 2
core/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java

@@ -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);
         }
     }

+ 2 - 2
core/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexResponse.java

@@ -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);
         }
     }

+ 4 - 1
core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java

@@ -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 {

+ 6 - 0
docs/reference/migration/migrate_7_0/cluster.asciidoc

@@ -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.

+ 2 - 2
rest-api-spec/src/main/resources/rest-api-spec/test/indices.open/10_basic.yml

@@ -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: