浏览代码

Revert "Return 200 OK response code for a cluster health timeout (#78968)" (#80821)

* Revert "Return 200 OK response code for a cluster health timeout (#78968)"

This reverts commit a2c3daea

* Revert "Allow deprecation warning for the return_200_for_cluster_health_timeout parameter (#80178)"

This reverts commit 1c711e35fcb957f9a2fa1f1dbeebb8d3afb144a0.

* Revert "Drop pre-7.2.0 wire format in ClusterHealthRequest (#79551)"

This reverts commit b9fbe66ab00398789fad8cc751ffecf13fc174d9.

* Revert "Adjust the BWC version for the return200ForClusterHealthTimeout field (#79436)"

This reverts commit f60bda5685dad18366decfe57a4dd95f58b152e2.

* Revert "Use query param instead of a system property for opting in for new cluster health response code (#79351)"

This reverts commit 8901a999

* Revert "Deprecate returning 408 for a server timeout on `_cluster/health` (#78180)"

This reverts commit f266eb32

* Drop pre-7.2.0 wire format in ClusterHealthRequest (#79551)

This reverts commit fa4d562c

* Revert "Disable BWC for #80821 (#80839)"

This reverts commit cb0e73e2fc74dd6cba651230c69ff6d35c6b974c.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Artem Prigoda 3 年之前
父节点
当前提交
89bbac9216
共有 20 个文件被更改,包括 30 次插入185 次删除
  1. 2 2
      build.gradle
  2. 1 1
      client/rest-high-level/src/test/java/org/elasticsearch/client/ClusterClientIT.java
  3. 0 20
      docs/changelog/78968.yaml
  4. 0 5
      docs/reference/cluster/health.asciidoc
  5. 0 4
      rest-api-spec/src/main/resources/rest-api-spec/api/cluster.health.json
  6. 2 31
      rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/20_request_timeout.yml
  7. 0 16
      server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java
  8. 6 24
      server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java
  9. 2 4
      server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java
  10. 0 5
      server/src/main/java/org/elasticsearch/common/xcontent/StatusToXContentObject.java
  11. 1 1
      server/src/main/java/org/elasticsearch/rest/action/RestStatusToXContentListener.java
  12. 0 18
      server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java
  13. 0 1
      server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequestTests.java
  14. 5 32
      server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java
  15. 5 5
      server/src/test/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthActionTests.java
  16. 0 11
      server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthActionTests.java
  17. 1 2
      x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/utils/MlIndexAndAliasTests.java
  18. 1 1
      x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManagerTests.java
  19. 2 0
      x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/rollup/security_tests.yml
  20. 2 2
      x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformInternalIndexTests.java

+ 2 - 2
build.gradle

@@ -131,9 +131,9 @@ tasks.register("verifyVersions") {
  * after the backport of the backcompat code is complete.
  */
 
-boolean bwc_tests_enabled = false
+boolean bwc_tests_enabled = true
 // place a PR link here when committing bwc changes:
-String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/80821"
+String bwc_tests_disabled_issue = ""
 /*
  * FIPS 140-2 behavior was fixed in 7.11.0. Before that there is no way to run elasticsearch in a
  * JVM that is properly configured to be in fips mode with BCFIPS. For now we need to disable

+ 1 - 1
client/rest-high-level/src/test/java/org/elasticsearch/client/ClusterClientIT.java

@@ -334,7 +334,7 @@ public class ClusterClientIT extends ESRestHighLevelClientTestCase {
 
         assertThat(response, notNullValue());
         assertThat(response.isTimedOut(), equalTo(true));
-        assertThat(response.status(), equalTo(RestStatus.OK));
+        assertThat(response.status(), equalTo(RestStatus.REQUEST_TIMEOUT));
         assertThat(response.getStatus(), equalTo(ClusterHealthStatus.RED));
         assertNoIndices(response);
     }

+ 0 - 20
docs/changelog/78968.yaml

@@ -1,20 +0,0 @@
-pr: 78968
-summary: HTTP Status code has changed for the Cluster Health API in case of a server timeout
-area: CRUD
-type: breaking
-issues: []
-breaking:
-  title: HTTP Status code has changed for the Cluster Health API in case of a server timeout
-  area: REST API
-  details: |-
-    The cluster health API includes options for waiting
-    for certain health conditions to be satisfied. If the requested conditions are
-    not satisfied within a timeout then ES will send back a normal response
-    including the field `"timed_out": true`. In earlier versions it would also use
-    the HTTP response code `408 Request timeout` if the request timed out, and `200
-    OK` otherwise. The `408 Request timeout` response code is not appropriate for
-    this situation, so from version 8.0.0 ES will use the response code `200 OK`
-    for both cases.
-  impact: |-
-    To detect a server timeout, check the `timed_out` field of the JSON response.
-  notable: true

+ 0 - 5
docs/reference/cluster/health.asciidoc

@@ -97,11 +97,6 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
     provided or better, i.e. `green` > `yellow` > `red`. By default, will not
     wait for any status.
 
-`return_200_for_cluster_health_timeout`::
-   (Optional, Boolean) A boolean value which controls whether to return HTTP 200
-   status code instead of HTTP 408 in case of a cluster health timeout from
-   the server side. Defaults to false.
-
 [[cluster-health-api-response-body]]
 ==== {api-response-body-title}
 

+ 0 - 4
rest-api-spec/src/main/resources/rest-api-spec/api/cluster.health.json

@@ -102,10 +102,6 @@
           "red"
         ],
         "description":"Wait until cluster is in a specific state"
-      },
-      "return_200_for_cluster_health_timeout":{
-        "type":"boolean",
-        "description":"Whether to return HTTP 200 instead of 408 in case of a cluster health timeout from the server side"
       }
     }
   }

+ 2 - 31
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/20_request_timeout.yml

@@ -1,9 +1,7 @@
 ---
 "cluster health request timeout on waiting for nodes":
-  - skip:
-      version: " - 8.0.99"
-      reason: "Set for 7.99.99 when back-ported to 8.0"
   - do:
+      catch: request_timeout
       cluster.health:
         wait_for_nodes: 10
         timeout: 1ms
@@ -21,10 +19,8 @@
 
 ---
 "cluster health request timeout waiting for active shards":
-  - skip:
-      version: " - 8.0.99"
-      reason: "Set for 7.99.99 when back-ported to 8.0"
   - do:
+      catch: request_timeout
       cluster.health:
         timeout: 1ms
         wait_for_active_shards: 5
@@ -39,28 +35,3 @@
   - match:     { initializing_shards:     0 }
   - match:     { unassigned_shards:       0 }
   - gte:       { number_of_pending_tasks: 0 }
-
----
-"cluster health request timeout with 200 response code":
-  - skip:
-      version: " - 7.15.99"
-      reason: "return_200_for_cluster_health_timeout was added in 7.16"
-      features: [ "allowed_warnings" ]
-  - do:
-      allowed_warnings:
-        - 'the [return_200_for_cluster_health_timeout] parameter is deprecated and will be removed in a future release.'
-      cluster.health:
-        timeout: 1ms
-        wait_for_active_shards: 5
-        return_200_for_cluster_health_timeout: true
-
-  - is_true:   cluster_name
-  - is_true:   timed_out
-  - gte:       { number_of_nodes:         1 }
-  - gte:       { number_of_data_nodes:    1 }
-  - match:     { active_primary_shards:   0 }
-  - match:     { active_shards:           0 }
-  - match:     { relocating_shards:       0 }
-  - match:     { initializing_shards:     0 }
-  - match:     { unassigned_shards:       0 }
-  - gte:       { number_of_pending_tasks: 0 }

+ 0 - 16
server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java

@@ -34,8 +34,6 @@ public class ClusterHealthRequest extends MasterNodeReadRequest<ClusterHealthReq
     private ActiveShardCount waitForActiveShards = ActiveShardCount.NONE;
     private String waitForNodes = "";
     private Priority waitForEvents = null;
-    private boolean return200ForClusterHealthTimeout;
-
     /**
      * Only used by the high-level REST Client. Controls the details level of the health information returned.
      * The default value is 'cluster'.
@@ -63,7 +61,6 @@ public class ClusterHealthRequest extends MasterNodeReadRequest<ClusterHealthReq
         }
         waitForNoInitializingShards = in.readBoolean();
         indicesOptions = IndicesOptions.readIndicesOptions(in);
-        return200ForClusterHealthTimeout = in.readBoolean();
     }
 
     @Override
@@ -92,7 +89,6 @@ public class ClusterHealthRequest extends MasterNodeReadRequest<ClusterHealthReq
         }
         out.writeBoolean(waitForNoInitializingShards);
         indicesOptions.writeIndicesOptions(out);
-        out.writeBoolean(return200ForClusterHealthTimeout);
     }
 
     @Override
@@ -236,18 +232,6 @@ public class ClusterHealthRequest extends MasterNodeReadRequest<ClusterHealthReq
         return this.waitForEvents;
     }
 
-    public boolean doesReturn200ForClusterHealthTimeout() {
-        return return200ForClusterHealthTimeout;
-    }
-
-    /**
-     * Sets whether to return HTTP 200 status code instead of HTTP 408 in case of a
-     * cluster health timeout from the server side.
-     */
-    public void return200ForClusterHealthTimeout(boolean return200ForClusterHealthTimeout) {
-        this.return200ForClusterHealthTimeout = return200ForClusterHealthTimeout;
-    }
-
     /**
      * Set the level of detail for the health information to be returned.
      * Only used by the high-level REST Client.

+ 6 - 24
server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java

@@ -17,7 +17,6 @@ import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.io.stream.StreamInput;
 import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.xcontent.StatusToXContentObject;
-import org.elasticsearch.core.RestApiVersion;
 import org.elasticsearch.core.TimeValue;
 import org.elasticsearch.rest.RestStatus;
 import org.elasticsearch.xcontent.ConstructingObjectParser;
@@ -152,7 +151,8 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo
     private boolean timedOut = false;
     private ClusterStateHealth clusterStateHealth;
     private ClusterHealthStatus clusterHealthStatus;
-    private boolean return200ForClusterHealthTimeout;
+
+    public ClusterHealthResponse() {}
 
     public ClusterHealthResponse(StreamInput in) throws IOException {
         super(in);
@@ -164,17 +164,11 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo
         numberOfInFlightFetch = in.readInt();
         delayedUnassignedShards = in.readInt();
         taskMaxWaitingTime = in.readTimeValue();
-        return200ForClusterHealthTimeout = in.readBoolean();
     }
 
     /** needed for plugins BWC */
-    public ClusterHealthResponse(
-        String clusterName,
-        String[] concreteIndices,
-        ClusterState clusterState,
-        boolean return200ForServerTimeout
-    ) {
-        this(clusterName, concreteIndices, clusterState, -1, -1, -1, TimeValue.timeValueHours(0), return200ForServerTimeout);
+    public ClusterHealthResponse(String clusterName, String[] concreteIndices, ClusterState clusterState) {
+        this(clusterName, concreteIndices, clusterState, -1, -1, -1, TimeValue.timeValueHours(0));
     }
 
     public ClusterHealthResponse(
@@ -184,8 +178,7 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo
         int numberOfPendingTasks,
         int numberOfInFlightFetch,
         int delayedUnassignedShards,
-        TimeValue taskMaxWaitingTime,
-        boolean return200ForServerTimeout
+        TimeValue taskMaxWaitingTime
     ) {
         this.clusterName = clusterName;
         this.numberOfPendingTasks = numberOfPendingTasks;
@@ -194,7 +187,6 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo
         this.taskMaxWaitingTime = taskMaxWaitingTime;
         this.clusterStateHealth = new ClusterStateHealth(clusterState, concreteIndices);
         this.clusterHealthStatus = clusterStateHealth.getStatus();
-        this.return200ForClusterHealthTimeout = return200ForServerTimeout;
     }
 
     /**
@@ -333,7 +325,6 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo
         out.writeInt(numberOfInFlightFetch);
         out.writeInt(delayedUnassignedShards);
         out.writeTimeValue(taskMaxWaitingTime);
-        out.writeBoolean(return200ForClusterHealthTimeout);
     }
 
     @Override
@@ -343,16 +334,7 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo
 
     @Override
     public RestStatus status() {
-        return status(RestApiVersion.current());
-    }
-
-    @Override
-    public RestStatus status(RestApiVersion restApiVersion) {
-        // Legacy behaviour
-        if (isTimedOut() && restApiVersion == RestApiVersion.V_7 && return200ForClusterHealthTimeout == false) {
-            return RestStatus.REQUEST_TIMEOUT;
-        }
-        return RestStatus.OK;
+        return isTimedOut() ? RestStatus.REQUEST_TIMEOUT : RestStatus.OK;
     }
 
     @Override

+ 2 - 4
server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java

@@ -411,8 +411,7 @@ public class TransportClusterHealthAction extends TransportMasterNodeReadAction<
                 numberOfPendingTasks,
                 numberOfInFlightFetch,
                 UnassignedInfo.getNumberOfDelayedUnassigned(clusterState),
-                pendingTaskTimeInQueue,
-                request.doesReturn200ForClusterHealthTimeout()
+                pendingTaskTimeInQueue
             );
             response.setStatus(ClusterHealthStatus.RED);
             return response;
@@ -425,8 +424,7 @@ public class TransportClusterHealthAction extends TransportMasterNodeReadAction<
             numberOfPendingTasks,
             numberOfInFlightFetch,
             UnassignedInfo.getNumberOfDelayedUnassigned(clusterState),
-            pendingTaskTimeInQueue,
-            request.doesReturn200ForClusterHealthTimeout()
+            pendingTaskTimeInQueue
         );
     }
 }

+ 0 - 5
server/src/main/java/org/elasticsearch/common/xcontent/StatusToXContentObject.java

@@ -7,7 +7,6 @@
  */
 package org.elasticsearch.common.xcontent;
 
-import org.elasticsearch.core.RestApiVersion;
 import org.elasticsearch.rest.RestStatus;
 import org.elasticsearch.xcontent.ToXContentObject;
 
@@ -21,8 +20,4 @@ public interface StatusToXContentObject extends ToXContentObject {
      * Returns the REST status to make sure it is returned correctly
      */
     RestStatus status();
-
-    default RestStatus status(RestApiVersion restApiVersion) {
-        return status();
-    }
 }

+ 1 - 1
server/src/main/java/org/elasticsearch/rest/action/RestStatusToXContentListener.java

@@ -44,7 +44,7 @@ public class RestStatusToXContentListener<Response extends StatusToXContentObjec
     public RestResponse buildResponse(Response response, XContentBuilder builder) throws Exception {
         assert response.isFragment() == false; // would be nice if we could make default methods final
         response.toXContent(builder, channel.request());
-        RestResponse restResponse = new BytesRestResponse(response.status(builder.getRestApiVersion()), builder);
+        RestResponse restResponse = new BytesRestResponse(response.status(), builder);
         if (RestStatus.CREATED == restResponse.status()) {
             final String location = extractLocation.apply(response);
             if (location != null) {

+ 0 - 18
server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java

@@ -15,12 +15,9 @@ import org.elasticsearch.client.node.NodeClient;
 import org.elasticsearch.cluster.health.ClusterHealthStatus;
 import org.elasticsearch.common.Priority;
 import org.elasticsearch.common.Strings;
-import org.elasticsearch.common.logging.DeprecationCategory;
-import org.elasticsearch.common.logging.DeprecationLogger;
 import org.elasticsearch.rest.BaseRestHandler;
 import org.elasticsearch.rest.RestRequest;
 import org.elasticsearch.rest.action.RestStatusToXContentListener;
-import org.elasticsearch.rest.action.search.RestSearchAction;
 
 import java.io.IOException;
 import java.util.Collections;
@@ -33,12 +30,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
 
 public class RestClusterHealthAction extends BaseRestHandler {
 
-    private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestSearchAction.class);
-    private static final String RETURN_200_FOR_CLUSTER_HEALTH_TIMEOUT = "return_200_for_cluster_health_timeout";
-    private static final String CLUSTER_HEALTH_REQUEST_TIMEOUT_DEPRECATION_MSG = "the ["
-        + RETURN_200_FOR_CLUSTER_HEALTH_TIMEOUT
-        + "] parameter is deprecated and will be removed in a future release.";
-
     @Override
     public List<Route> routes() {
         return List.of(new Route(GET, "/_cluster/health"), new Route(GET, "/_cluster/health/{index}"));
@@ -90,15 +81,6 @@ public class RestClusterHealthAction extends BaseRestHandler {
         if (request.param("wait_for_events") != null) {
             clusterHealthRequest.waitForEvents(Priority.valueOf(request.param("wait_for_events").toUpperCase(Locale.ROOT)));
         }
-        String return200ForClusterHealthTimeout = request.param(RETURN_200_FOR_CLUSTER_HEALTH_TIMEOUT);
-        if (return200ForClusterHealthTimeout != null) {
-            deprecationLogger.warn(
-                DeprecationCategory.API,
-                "cluster_health_request_timeout",
-                CLUSTER_HEALTH_REQUEST_TIMEOUT_DEPRECATION_MSG
-            );
-        }
-        clusterHealthRequest.return200ForClusterHealthTimeout(Boolean.parseBoolean(return200ForClusterHealthTimeout));
         return clusterHealthRequest;
     }
 

+ 0 - 1
server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequestTests.java

@@ -39,7 +39,6 @@ public class ClusterHealthRequestTests extends ESTestCase {
         assertThat(cloneRequest.waitForEvents(), equalTo(originalRequest.waitForEvents()));
         assertIndicesEquals(cloneRequest.indices(), originalRequest.indices());
         assertThat(cloneRequest.indicesOptions(), equalTo(originalRequest.indicesOptions()));
-        assertThat(cloneRequest.doesReturn200ForClusterHealthTimeout(), equalTo(originalRequest.doesReturn200ForClusterHealthTimeout()));
     }
 
     public void testRequestReturnsHiddenIndicesByDefault() {

+ 5 - 32
server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java

@@ -15,12 +15,10 @@ import org.elasticsearch.cluster.health.ClusterIndexHealth;
 import org.elasticsearch.cluster.health.ClusterIndexHealthTests;
 import org.elasticsearch.cluster.health.ClusterStateHealth;
 import org.elasticsearch.cluster.metadata.Metadata;
-import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.io.stream.BytesStreamOutput;
 import org.elasticsearch.common.io.stream.StreamInput;
 import org.elasticsearch.common.io.stream.Writeable;
 import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.core.RestApiVersion;
 import org.elasticsearch.core.TimeValue;
 import org.elasticsearch.rest.RestStatus;
 import org.elasticsearch.test.AbstractSerializingTestCase;
@@ -44,38 +42,14 @@ import static org.hamcrest.Matchers.lessThanOrEqualTo;
 public class ClusterHealthResponsesTests extends AbstractSerializingTestCase<ClusterHealthResponse> {
     private final ClusterHealthRequest.Level level = randomFrom(ClusterHealthRequest.Level.values());
 
-    public void testIsTimeoutReturns200ByDefault() {
-        ClusterHealthResponse res = new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, false);
-        for (int i = 0; i < 5; i++) {
-            res.setTimedOut(randomBoolean());
-            assertEquals(RestStatus.OK, res.status(RestApiVersion.V_8));
-        }
-    }
-
-    public void testTimeoutReturns200IfOptedIn() {
-        ClusterHealthResponse res = new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, true);
-        for (int i = 0; i < 5; i++) {
-            res.setTimedOut(randomBoolean());
-            assertEquals(RestStatus.OK, res.status(RestApiVersion.V_8));
-        }
-    }
-
-    public void testTimeoutReturns200InIfOptedInV7CompatibilityMode() {
-        ClusterHealthResponse res = new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, true);
-        for (int i = 0; i < 5; i++) {
-            res.setTimedOut(randomBoolean());
-            assertEquals(RestStatus.OK, res.status(RestApiVersion.V_7));
-        }
-    }
-
-    public void testTimeoutReturns408InV7CompatibilityMode() {
-        ClusterHealthResponse res = new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, false);
+    public void testIsTimeout() {
+        ClusterHealthResponse res = new ClusterHealthResponse();
         for (int i = 0; i < 5; i++) {
             res.setTimedOut(randomBoolean());
             if (res.isTimedOut()) {
-                assertEquals(RestStatus.REQUEST_TIMEOUT, res.status(RestApiVersion.V_7));
+                assertEquals(RestStatus.REQUEST_TIMEOUT, res.status());
             } else {
-                assertEquals(RestStatus.OK, res.status(RestApiVersion.V_7));
+                assertEquals(RestStatus.OK, res.status());
             }
         }
     }
@@ -93,8 +67,7 @@ public class ClusterHealthResponsesTests extends AbstractSerializingTestCase<Clu
             pendingTasks,
             inFlight,
             delayedUnassigned,
-            pendingTaskInQueueTime,
-            false
+            pendingTaskInQueueTime
         );
         clusterHealth = maybeSerialize(clusterHealth);
         assertClusterHealth(clusterHealth);

+ 5 - 5
server/src/test/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthActionTests.java

@@ -37,17 +37,17 @@ public class TransportClusterHealthActionTests extends ESTestCase {
         final ClusterHealthRequest request = new ClusterHealthRequest();
         request.waitForNoInitializingShards(true);
         ClusterState clusterState = randomClusterStateWithInitializingShards("test", 0);
-        ClusterHealthResponse response = new ClusterHealthResponse("", indices, clusterState, false);
+        ClusterHealthResponse response = new ClusterHealthResponse("", indices, clusterState);
         assertThat(TransportClusterHealthAction.prepareResponse(request, response, clusterState, null), equalTo(1));
 
         request.waitForNoInitializingShards(true);
         clusterState = randomClusterStateWithInitializingShards("test", between(1, 10));
-        response = new ClusterHealthResponse("", indices, clusterState, false);
+        response = new ClusterHealthResponse("", indices, clusterState);
         assertThat(TransportClusterHealthAction.prepareResponse(request, response, clusterState, null), equalTo(0));
 
         request.waitForNoInitializingShards(false);
         clusterState = randomClusterStateWithInitializingShards("test", randomInt(20));
-        response = new ClusterHealthResponse("", indices, clusterState, false);
+        response = new ClusterHealthResponse("", indices, clusterState);
         assertThat(TransportClusterHealthAction.prepareResponse(request, response, clusterState, null), equalTo(0));
     }
 
@@ -57,11 +57,11 @@ public class TransportClusterHealthActionTests extends ESTestCase {
         request.waitForActiveShards(ActiveShardCount.ALL);
 
         ClusterState clusterState = randomClusterStateWithInitializingShards("test", 1);
-        ClusterHealthResponse response = new ClusterHealthResponse("", indices, clusterState, false);
+        ClusterHealthResponse response = new ClusterHealthResponse("", indices, clusterState);
         assertThat(TransportClusterHealthAction.prepareResponse(request, response, clusterState, null), equalTo(0));
 
         clusterState = ClusterState.builder(ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY)).build();
-        response = new ClusterHealthResponse("", indices, clusterState, false);
+        response = new ClusterHealthResponse("", indices, clusterState);
         assertThat(TransportClusterHealthAction.prepareResponse(request, response, clusterState, null), equalTo(1));
     }
 

+ 0 - 11
server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthActionTests.java

@@ -8,7 +8,6 @@
 
 package org.elasticsearch.rest.action.admin.cluster;
 
-import org.apache.logging.log4j.Level;
 import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
 import org.elasticsearch.action.support.ActiveShardCount;
 import org.elasticsearch.cluster.health.ClusterHealthStatus;
@@ -52,8 +51,6 @@ public class RestClusterHealthActionTests extends ESTestCase {
         params.put("wait_for_active_shards", String.valueOf(waitForActiveShards));
         params.put("wait_for_nodes", waitForNodes);
         params.put("wait_for_events", waitForEvents.name());
-        boolean requestTimeout200 = randomBoolean();
-        params.put("return_200_for_cluster_health_timeout", String.valueOf(requestTimeout200));
 
         FakeRestRequest restRequest = buildRestRequest(params);
         ClusterHealthRequest clusterHealthRequest = RestClusterHealthAction.fromRequest(restRequest);
@@ -68,15 +65,7 @@ public class RestClusterHealthActionTests extends ESTestCase {
         assertThat(clusterHealthRequest.waitForActiveShards(), equalTo(ActiveShardCount.parseString(String.valueOf(waitForActiveShards))));
         assertThat(clusterHealthRequest.waitForNodes(), equalTo(waitForNodes));
         assertThat(clusterHealthRequest.waitForEvents(), equalTo(waitForEvents));
-        assertThat(clusterHealthRequest.doesReturn200ForClusterHealthTimeout(), equalTo(requestTimeout200));
 
-        assertWarnings(
-            true,
-            new DeprecationWarning(
-                Level.WARN,
-                "the [return_200_for_cluster_health_timeout] parameter is deprecated and will be removed in a future release."
-            )
-        );
     }
 
     private FakeRestRequest buildRestRequest(Map<String, String> params) {

+ 1 - 2
x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/utils/MlIndexAndAliasTests.java

@@ -35,7 +35,6 @@ import org.elasticsearch.cluster.metadata.IndexTemplateMetadata;
 import org.elasticsearch.cluster.metadata.Metadata;
 import org.elasticsearch.cluster.node.DiscoveryNode;
 import org.elasticsearch.cluster.node.DiscoveryNodes;
-import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.collect.ImmutableOpenMap;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.transport.TransportAddress;
@@ -110,7 +109,7 @@ public class MlIndexAndAliasTests extends ESTestCase {
         clusterAdminClient = mock(ClusterAdminClient.class);
         doAnswer(invocationOnMock -> {
             ActionListener<ClusterHealthResponse> listener = (ActionListener<ClusterHealthResponse>) invocationOnMock.getArguments()[1];
-            listener.onResponse(new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, false));
+            listener.onResponse(new ClusterHealthResponse());
             return null;
         }).when(clusterAdminClient).health(any(ClusterHealthRequest.class), any(ActionListener.class));
 

+ 1 - 1
x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManagerTests.java

@@ -174,7 +174,7 @@ public class AutodetectProcessManagerTests extends ESTestCase {
                 if (t.getTypeName().contains("ClusterHealthResponse")) {
                     ActionListener<ClusterHealthResponse> listener = (ActionListener<ClusterHealthResponse>) l;
                     listener.onResponse(
-                        new ClusterHealthResponse("test", new String[0], ClusterState.EMPTY_STATE, 0, 0, 0, TimeValue.ZERO, false)
+                        new ClusterHealthResponse("test", new String[0], ClusterState.EMPTY_STATE, 0, 0, 0, TimeValue.ZERO)
                     );
                     return null;
                 }

+ 2 - 0
x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/rollup/security_tests.yml

@@ -126,6 +126,7 @@ teardown:
 
   # this is a hacky way to sleep for 5s, since we will never have 10 nodes
   - do:
+      catch: request_timeout
       cluster.health:
         wait_for_nodes: 10
         timeout: "5s"
@@ -285,6 +286,7 @@ teardown:
 
   # this is a hacky way to sleep for 5s, since we will never have 10 nodes
   - do:
+      catch: request_timeout
       cluster.health:
         wait_for_nodes: 10
         timeout: "5s"

+ 2 - 2
x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformInternalIndexTests.java

@@ -173,7 +173,7 @@ public class TransformInternalIndexTests extends ESTestCase {
         doAnswer(invocationOnMock -> {
             @SuppressWarnings("unchecked")
             ActionListener<ClusterHealthResponse> listener = (ActionListener<ClusterHealthResponse>) invocationOnMock.getArguments()[1];
-            listener.onResponse(new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, false));
+            listener.onResponse(new ClusterHealthResponse());
             return null;
         }).when(clusterClient).health(any(), any());
 
@@ -257,7 +257,7 @@ public class TransformInternalIndexTests extends ESTestCase {
         doAnswer(invocationOnMock -> {
             @SuppressWarnings("unchecked")
             ActionListener<ClusterHealthResponse> listener = (ActionListener<ClusterHealthResponse>) invocationOnMock.getArguments()[1];
-            listener.onResponse(new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, false));
+            listener.onResponse(new ClusterHealthResponse());
             return null;
         }).when(clusterClient).health(any(), any());