瀏覽代碼

reduce the number of iterations in testPrimaryRelocationWhileIndexing and flush every 5

Without flushing the translog doubles it's size on every recovery
Boaz Leskes 8 年之前
父節點
當前提交
396b8b371c
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      core/src/test/java/org/elasticsearch/indices/recovery/IndexPrimaryRelocationIT.java

+ 5 - 2
core/src/test/java/org/elasticsearch/indices/recovery/IndexPrimaryRelocationIT.java

@@ -42,7 +42,7 @@ import static org.hamcrest.Matchers.equalTo;
 @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST)
 public class IndexPrimaryRelocationIT extends ESIntegTestCase {
 
-    private static final int RELOCATION_COUNT = 25;
+    private static final int RELOCATION_COUNT = 15;
 
     @TestLogging("_root:DEBUG,org.elasticsearch.action.bulk:TRACE,org.elasticsearch.index.shard:TRACE,org.elasticsearch.cluster.service:TRACE")
     public void testPrimaryRelocationWhileIndexing() throws Exception {
@@ -88,7 +88,10 @@ public class IndexPrimaryRelocationIT extends ESIntegTestCase {
             if (indexingThread.isAlive() == false) { // indexing process aborted early, no need for more relocations as test has already failed
                 break;
             }
-
+            if (i > 0  && i % 5 == 0) {
+                logger.info("--> [iteration {}] flushing index", i);
+                client().admin().indices().prepareFlush("test").get();
+            }
         }
         finished.set(true);
         indexingThread.join();