|
30 | 30 | import org.elasticsearch.cluster.routing.ShardRouting; |
31 | 31 | import org.elasticsearch.cluster.service.ClusterService; |
32 | 32 | import org.elasticsearch.common.Priority; |
| 33 | +import org.elasticsearch.common.settings.Setting; |
33 | 34 | import org.elasticsearch.common.settings.Settings; |
34 | 35 | import org.elasticsearch.common.unit.TimeValue; |
| 36 | +import org.elasticsearch.index.IndexService; |
35 | 37 | import org.elasticsearch.index.IndexSettings; |
36 | 38 | import org.elasticsearch.index.shard.DocsStats; |
37 | 39 | import org.elasticsearch.index.shard.ShardId; |
38 | 40 | import org.elasticsearch.index.translog.Translog; |
| 41 | +import org.elasticsearch.plugins.Plugin; |
39 | 42 | import org.elasticsearch.search.sort.SortOrder; |
40 | 43 | import org.elasticsearch.test.BackgroundIndexer; |
41 | 44 | import org.elasticsearch.test.ESIntegTestCase; |
42 | 45 | import org.elasticsearch.test.junit.annotations.TestLogging; |
43 | 46 |
|
44 | 47 | import java.util.Arrays; |
| 48 | +import java.util.Collection; |
| 49 | +import java.util.Collections; |
| 50 | +import java.util.List; |
45 | 51 | import java.util.Set; |
46 | 52 | import java.util.concurrent.TimeUnit; |
| 53 | +import java.util.stream.Collectors; |
| 54 | +import java.util.stream.Stream; |
47 | 55 |
|
48 | 56 | import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; |
49 | 57 | import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; |
|
58 | 66 | public class RecoveryWhileUnderLoadIT extends ESIntegTestCase { |
59 | 67 | private final Logger logger = LogManager.getLogger(RecoveryWhileUnderLoadIT.class); |
60 | 68 |
|
| 69 | + public static final class RetentionLeaseSyncIntervalSettingPlugin extends Plugin { |
| 70 | + |
| 71 | + @Override |
| 72 | + public List<Setting<?>> getSettings() { |
| 73 | + return Collections.singletonList(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING); |
| 74 | + } |
| 75 | + |
| 76 | + } |
| 77 | + |
| 78 | + @Override |
| 79 | + protected Collection<Class<? extends Plugin>> nodePlugins() { |
| 80 | + return Stream.concat( |
| 81 | + super.nodePlugins().stream(), |
| 82 | + Stream.of(RetentionLeaseSyncIntervalSettingPlugin.class)) |
| 83 | + .collect(Collectors.toList()); |
| 84 | + } |
| 85 | + |
61 | 86 | public void testRecoverWhileUnderLoadAllocateReplicasTest() throws Exception { |
62 | 87 | logger.info("--> creating test index ..."); |
63 | 88 | int numberOfShards = numberOfShards(); |
@@ -260,7 +285,8 @@ public void testRecoverWhileRelocating() throws Exception { |
260 | 285 | assertAcked(prepareCreate("test", 3, Settings.builder() |
261 | 286 | .put(SETTING_NUMBER_OF_SHARDS, numShards) |
262 | 287 | .put(SETTING_NUMBER_OF_REPLICAS, numReplicas) |
263 | | - .put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC))); |
| 288 | + .put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC) |
| 289 | + .put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), randomFrom("100ms", "1s", "5s", "30s", "60s")))); |
264 | 290 |
|
265 | 291 | final int numDocs = scaledRandomIntBetween(200, 9999); |
266 | 292 |
|
|
0 commit comments