Browse Source

Disable rebalancing in `DataStreamLifecycleDownsampleDisruptionIT` (#133036) (#133434)

We were seeing test failures here due by the relocation of some shards
taking more than 30 seconds. This happened after downsampling had
already completed, causing the `ensureGreen` at the end of the test to
time out.

The Distributed Coordination team suggested disabling shard rebalancing
in this test (among other things, which have already been implemented).

Fixes #131394

(cherry picked from commit 7519de64ab936be1288174962ba01122dccb6da4)

# Conflicts:
#	muted-tests.yml
Niels Bauman 2 months ago
parent
commit
0c781091a2

+ 8 - 4
x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DataStreamLifecycleDownsampleDisruptionIT.java

@@ -14,6 +14,7 @@ import org.elasticsearch.action.admin.indices.rollover.RolloverRequest;
 import org.elasticsearch.action.downsample.DownsampleConfig;
 import org.elasticsearch.cluster.metadata.DataStreamLifecycle;
 import org.elasticsearch.cluster.metadata.IndexMetadata;
+import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
 import org.elasticsearch.cluster.service.ClusterService;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.core.TimeValue;
@@ -34,9 +35,12 @@ public class DataStreamLifecycleDownsampleDisruptionIT extends DownsamplingInteg
 
     @Override
     protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
-        Settings.Builder settings = Settings.builder().put(super.nodeSettings(nodeOrdinal, otherSettings));
-        settings.put(DataStreamLifecycleService.DATA_STREAM_LIFECYCLE_POLL_INTERVAL, "1s");
-        return settings.build();
+        return Settings.builder()
+            .put(super.nodeSettings(nodeOrdinal, otherSettings))
+            .put(DataStreamLifecycleService.DATA_STREAM_LIFECYCLE_POLL_INTERVAL, "1s")
+            // We disable shard rebalancing to avoid shard relocations timing out the `ensureGreen` call at the end of the test. See #131394
+            .put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), "none")
+            .build();
     }
 
     public void testDataStreamLifecycleDownsampleRollingRestart() throws Exception {
@@ -85,7 +89,7 @@ public class DataStreamLifecycleDownsampleDisruptionIT extends DownsamplingInteg
 
         ensureDownsamplingStatus(targetIndex, IndexMetadata.DownsampleTaskStatus.SUCCESS, TimeValue.timeValueSeconds(120));
         ensureGreen(targetIndex);
-        logger.info("-> Relocation has finished");
+        logger.info("-> Index is green and downsampling completed successfully.");
     }
 
     private void ensureDownsamplingStatus(String downsampledIndex, IndexMetadata.DownsampleTaskStatus expectedStatus, TimeValue timeout) {