diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java index 9e5137d3cd1af..6ec36fe4762ff 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java @@ -15,6 +15,7 @@ import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest; import org.elasticsearch.action.admin.indices.get.GetIndexResponse; import org.elasticsearch.action.admin.indices.refresh.RefreshResponse; +import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest; import org.elasticsearch.action.admin.indices.stats.ShardStats; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchResponse; @@ -27,6 +28,7 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.routing.ShardRouting; +import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Priority; @@ -138,6 +140,18 @@ public final void startClusters() throws Exception { assertAcked(followerClient().admin().cluster().updateSettings(updateSettingsRequest).actionGet()); } + /** + * Follower indices don't get all the settings from leader, for example 'index.unassigned.node_left.delayed_timeout' + * is not replicated and if tests kill nodes, we have to wait 60s by default... + */ + protected void disableDelayedAllocation(String index) { + UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest(index); + Settings.Builder settingsBuilder = Settings.builder(); + settingsBuilder.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), 0); + updateSettingsRequest.settings(settingsBuilder); + assertAcked(followerClient().admin().indices().updateSettings(updateSettingsRequest).actionGet()); + } + @After public void afterTest() throws Exception { ensureEmptyWriteBuffers(); @@ -350,6 +364,7 @@ protected String getIndexSettings(final int numberOfShards, final int numberOfRe { builder.startObject("settings"); { + builder.field(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), 0); builder.field("index.number_of_shards", numberOfShards); builder.field("index.number_of_replicas", numberOfReplicas); for (final Map.Entry additionalSetting : additionalIndexSettings.entrySet()) { diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/FollowerFailOverIT.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/FollowerFailOverIT.java index 6685776e9805d..d58a2d0a0f18d 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/FollowerFailOverIT.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/FollowerFailOverIT.java @@ -85,6 +85,7 @@ public void testFailOverOnFollower() throws Exception { follow.getFollowRequest().setMaxOutstandingWriteRequests(randomIntBetween(1, 10)); logger.info("--> follow params {}", Strings.toString(follow.getFollowRequest())); followerClient().execute(PutFollowAction.INSTANCE, follow).get(); + disableDelayedAllocation("follower-index"); ensureFollowerGreen("follower-index"); awaitGlobalCheckpointAtLeast(followerClient(), new ShardId(resolveFollowerIndex("follower-index"), 0), between(30, 80)); final ClusterState clusterState = getFollowerCluster().clusterService().state(); @@ -143,6 +144,7 @@ public void testFollowIndexAndCloseNode() throws Exception { followRequest.getFollowRequest().setMaxWriteRequestSize(new ByteSizeValue(randomIntBetween(1, 4096), ByteSizeUnit.KB)); followRequest.getFollowRequest().setMaxOutstandingWriteRequests(randomIntBetween(1, 10)); followerClient().execute(PutFollowAction.INSTANCE, followRequest).get(); + disableDelayedAllocation("index2"); logger.info("--> follow params {}", Strings.toString(followRequest.getFollowRequest())); int maxOpsPerRead = followRequest.getFollowRequest().getMaxReadRequestOperationCount();