From 68c5206e507602fb3cffbd3581bb6366a40ae6ef Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Tue, 23 Sep 2014 12:29:02 +0200 Subject: [PATCH] [TEST] disable translog based flushes when corrupting files These tests rely on the fact that all files stay the same after the corruption and if we run into a translog based flush we might use a new / different delete file causing the test to fail. --- .../java/org/elasticsearch/index/store/CorruptedFileTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java index c948f0663be..aa83c53344e 100644 --- a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java +++ b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java @@ -61,6 +61,7 @@ import org.elasticsearch.index.shard.IndexShardState; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.service.IndexShard; import org.elasticsearch.index.shard.service.InternalIndexShard; +import org.elasticsearch.index.translog.TranslogService; import org.elasticsearch.indices.IndicesLifecycle; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.indices.recovery.RecoveryFileChunkRequest; @@ -118,6 +119,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { .put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, NoMergePolicyProvider.class) .put(MockFSDirectoryService.CHECK_INDEX_ON_CLOSE, false) // no checkindex - we corrupt shards on purpose .put(InternalEngine.INDEX_FAIL_ON_CORRUPTION, failOnCorruption) + .put(TranslogService.INDEX_TRANSLOG_DISABLE_FLUSH, true) // no translog based flush - it might change the .del / segments.N files .put("indices.recovery.concurrent_streams", 10) )); if (failOnCorruption == false) { // test the dynamic setting @@ -226,6 +228,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { .put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, NoMergePolicyProvider.class) .put(MockFSDirectoryService.CHECK_INDEX_ON_CLOSE, false) // no checkindex - we corrupt shards on purpose .put(InternalEngine.INDEX_FAIL_ON_CORRUPTION, true) + .put(TranslogService.INDEX_TRANSLOG_DISABLE_FLUSH, true) // no translog based flush - it might change the .del / segments.N files .put("indices.recovery.concurrent_streams", 10) )); ensureGreen(); @@ -397,6 +400,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { .put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, NoMergePolicyProvider.class) .put(MockFSDirectoryService.CHECK_INDEX_ON_CLOSE, false) // no checkindex - we corrupt shards on purpose .put(InternalEngine.INDEX_FAIL_ON_CORRUPTION, true) + .put(TranslogService.INDEX_TRANSLOG_DISABLE_FLUSH, true) // no translog based flush - it might change the .del / segments.N files .put("indices.recovery.concurrent_streams", 10) )); ensureGreen();