From 7892c7c86942350f6b4167976df76d15e5f7b797 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Mon, 18 May 2015 11:03:11 +0200 Subject: [PATCH] remove flushing before running checkindex --- .../index/store/CorruptedTranslogTests.java | 1 - .../snapshots/SharedClusterSnapshotRestoreTests.java | 2 +- .../elasticsearch/test/store/MockFSDirectoryService.java | 9 --------- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/test/java/org/elasticsearch/index/store/CorruptedTranslogTests.java b/src/test/java/org/elasticsearch/index/store/CorruptedTranslogTests.java index 4692823e9a2..738f4c106b1 100644 --- a/src/test/java/org/elasticsearch/index/store/CorruptedTranslogTests.java +++ b/src/test/java/org/elasticsearch/index/store/CorruptedTranslogTests.java @@ -82,7 +82,6 @@ public class CorruptedTranslogTests extends ElasticsearchIntegrationTest { .put("index.number_of_shards", 1) .put("index.number_of_replicas", 0) .put("index.refresh_interval", "-1") - .put(IndexStoreModule.STORE_TYPE, IndexStoreModule.Type.DEFAULT) // no mock store - it commits for check-index .put(MockEngineSupport.FLUSH_ON_CLOSE_RATIO, 0.0d) // never flush - always recover from translog .put(IndexShard.INDEX_FLUSH_ON_CLOSE, false) // never flush - always recover from translog .put(TranslogConfig.INDEX_TRANSLOG_SYNC_INTERVAL, "1s") // fsync the translog every second diff --git a/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreTests.java b/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreTests.java index 37adeca328f..4ef3a153204 100644 --- a/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreTests.java +++ b/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreTests.java @@ -1556,7 +1556,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { SnapshotStatus snapshotStatus = client.admin().cluster().prepareSnapshotStatus("test-repo").setSnapshots("test-1").get().getSnapshots().get(0); List shards = snapshotStatus.getShards(); for (SnapshotIndexShardStatus status : shards) { - assertThat(status.getStats().getProcessedFiles(), equalTo(1)); // we flush before the snapshot such that we have to process the segments_N files + assertThat(status.getStats().getProcessedFiles(), equalTo(0)); } } diff --git a/src/test/java/org/elasticsearch/test/store/MockFSDirectoryService.java b/src/test/java/org/elasticsearch/test/store/MockFSDirectoryService.java index 2a8d7cff621..00e493da1c3 100644 --- a/src/test/java/org/elasticsearch/test/store/MockFSDirectoryService.java +++ b/src/test/java/org/elasticsearch/test/store/MockFSDirectoryService.java @@ -107,16 +107,7 @@ public class MockFSDirectoryService extends FsDirectoryService { public void beforeIndexShardClosed(ShardId sid, @Nullable IndexShard indexShard, @IndexSettings Settings indexSettings) { if (indexShard != null && shardId.equals(sid)) { - logger.info("{} shard state before potentially flushing is {}", indexShard.shardId(), indexShard.state()); if (validCheckIndexStates.contains(indexShard.state()) && IndexMetaData.isOnSharedFilesystem(indexSettings) == false) { - // When the the internal engine closes we do a rollback, which removes uncommitted segments - // By doing a commit flush we perform a Lucene commit, but don't clear the translog, - // so that even in tests where don't flush we can check the integrity of the Lucene index - if (indexShard.engine().hasUncommittedChanges()) { // only if we have any changes - logger.info("{} flushing in order to run checkindex", indexShard.shardId()); - Releasables.close(indexShard.engine().snapshotIndex(true)); // Keep translog for tests that rely on replaying it - } - logger.info("{} flush finished in beforeIndexShardClosed", indexShard.shardId()); canRun = true; } }