[TEST] Set 'index.unassigned.node_left.delayed_timeout' to 0 in ccr tests

Some tests kill nodes and otherwise it would take 60s by default
for replicas to get allocated and that is longer than we wait
for getting in a green state in tests.

Relates to #35403
This commit is contained in:
Martijn van Groningen 2018-11-30 10:58:46 +01:00
parent 5c7b2c5f9b
commit 32f7fbd9f0
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
2 changed files with 17 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse;
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.health.ClusterHealthStatus;
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 abstract class CcrIntegTestCase extends ESTestCase {
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 @@ public abstract class CcrIntegTestCase extends ESTestCase {
{
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<String, String> additionalSetting : additionalIndexSettings.entrySet()) {

View File

@ -85,6 +85,7 @@ public class FollowerFailOverIT extends CcrIntegTestCase {
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 class FollowerFailOverIT extends CcrIntegTestCase {
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();