浏览代码

Force flush in translog retention policy test (#47879)

If we roll translog but do not index, then a flush without force is a 
noop. In this case, the number of retained translog files will be higher
than the value specified by the retention policy.

Closes #4741
Nhat Nguyen 6 年之前
父节点
当前提交
6731e9f9c8
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      server/src/test/java/org/elasticsearch/index/shard/IndexShardIT.java

+ 2 - 2
server/src/test/java/org/elasticsearch/index/shard/IndexShardIT.java

@@ -855,7 +855,7 @@ public class IndexShardIT extends ESSingleNodeTestCase {
         }
         }
     }
     }
 
 
-    public void testLimitNumberOfRetainingTranslogFiles() throws Exception {
+    public void testLimitNumberOfRetainedTranslogFiles() throws Exception {
         String indexName = "test";
         String indexName = "test";
         int translogRetentionTotalFiles = randomIntBetween(0, 50);
         int translogRetentionTotalFiles = randomIntBetween(0, 50);
         Settings.Builder settings = Settings.builder()
         Settings.Builder settings = Settings.builder()
@@ -888,7 +888,7 @@ public class IndexShardIT extends ESSingleNodeTestCase {
                 shard.rollTranslogGeneration();
                 shard.rollTranslogGeneration();
             }
             }
         }
         }
-        client().admin().indices().prepareFlush(indexName).get();
+        client().admin().indices().prepareFlush(indexName).setForce(true).setWaitIfOngoing(true).get();
         checkTranslog.run();
         checkTranslog.run();
     }
     }