[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:
parent
5c7b2c5f9b
commit
32f7fbd9f0
|
@ -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.cluster.settings.ClusterUpdateSettingsRequest;
|
||||||
import org.elasticsearch.action.admin.indices.get.GetIndexResponse;
|
import org.elasticsearch.action.admin.indices.get.GetIndexResponse;
|
||||||
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
|
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.admin.indices.stats.ShardStats;
|
||||||
import org.elasticsearch.action.search.SearchRequest;
|
import org.elasticsearch.action.search.SearchRequest;
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
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.IndexMetaData;
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||||
|
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||||
import org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings;
|
import org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings;
|
||||||
import org.elasticsearch.cluster.service.ClusterService;
|
import org.elasticsearch.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.Priority;
|
import org.elasticsearch.common.Priority;
|
||||||
|
@ -138,6 +140,18 @@ public abstract class CcrIntegTestCase extends ESTestCase {
|
||||||
assertAcked(followerClient().admin().cluster().updateSettings(updateSettingsRequest).actionGet());
|
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
|
@After
|
||||||
public void afterTest() throws Exception {
|
public void afterTest() throws Exception {
|
||||||
ensureEmptyWriteBuffers();
|
ensureEmptyWriteBuffers();
|
||||||
|
@ -350,6 +364,7 @@ public abstract class CcrIntegTestCase extends ESTestCase {
|
||||||
{
|
{
|
||||||
builder.startObject("settings");
|
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_shards", numberOfShards);
|
||||||
builder.field("index.number_of_replicas", numberOfReplicas);
|
builder.field("index.number_of_replicas", numberOfReplicas);
|
||||||
for (final Map.Entry<String, String> additionalSetting : additionalIndexSettings.entrySet()) {
|
for (final Map.Entry<String, String> additionalSetting : additionalIndexSettings.entrySet()) {
|
||||||
|
|
|
@ -85,6 +85,7 @@ public class FollowerFailOverIT extends CcrIntegTestCase {
|
||||||
follow.getFollowRequest().setMaxOutstandingWriteRequests(randomIntBetween(1, 10));
|
follow.getFollowRequest().setMaxOutstandingWriteRequests(randomIntBetween(1, 10));
|
||||||
logger.info("--> follow params {}", Strings.toString(follow.getFollowRequest()));
|
logger.info("--> follow params {}", Strings.toString(follow.getFollowRequest()));
|
||||||
followerClient().execute(PutFollowAction.INSTANCE, follow).get();
|
followerClient().execute(PutFollowAction.INSTANCE, follow).get();
|
||||||
|
disableDelayedAllocation("follower-index");
|
||||||
ensureFollowerGreen("follower-index");
|
ensureFollowerGreen("follower-index");
|
||||||
awaitGlobalCheckpointAtLeast(followerClient(), new ShardId(resolveFollowerIndex("follower-index"), 0), between(30, 80));
|
awaitGlobalCheckpointAtLeast(followerClient(), new ShardId(resolveFollowerIndex("follower-index"), 0), between(30, 80));
|
||||||
final ClusterState clusterState = getFollowerCluster().clusterService().state();
|
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().setMaxWriteRequestSize(new ByteSizeValue(randomIntBetween(1, 4096), ByteSizeUnit.KB));
|
||||||
followRequest.getFollowRequest().setMaxOutstandingWriteRequests(randomIntBetween(1, 10));
|
followRequest.getFollowRequest().setMaxOutstandingWriteRequests(randomIntBetween(1, 10));
|
||||||
followerClient().execute(PutFollowAction.INSTANCE, followRequest).get();
|
followerClient().execute(PutFollowAction.INSTANCE, followRequest).get();
|
||||||
|
disableDelayedAllocation("index2");
|
||||||
logger.info("--> follow params {}", Strings.toString(followRequest.getFollowRequest()));
|
logger.info("--> follow params {}", Strings.toString(followRequest.getFollowRequest()));
|
||||||
|
|
||||||
int maxOpsPerRead = followRequest.getFollowRequest().getMaxReadRequestOperationCount();
|
int maxOpsPerRead = followRequest.getFollowRequest().getMaxReadRequestOperationCount();
|
||||||
|
|
Loading…
Reference in New Issue