From 4c1bb210cb69c4350b1105f98c5156dda91f8817 Mon Sep 17 00:00:00 2001 From: Nhat Nguyen Date: Fri, 11 Oct 2019 21:09:54 -0400 Subject: [PATCH] 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 --- .../test/java/org/elasticsearch/index/shard/IndexShardIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/index/shard/IndexShardIT.java b/server/src/test/java/org/elasticsearch/index/shard/IndexShardIT.java index a15c6c26cdd..b0c13415330 100644 --- a/server/src/test/java/org/elasticsearch/index/shard/IndexShardIT.java +++ b/server/src/test/java/org/elasticsearch/index/shard/IndexShardIT.java @@ -857,7 +857,7 @@ public class IndexShardIT extends ESSingleNodeTestCase { } } - public void testLimitNumberOfRetainingTranslogFiles() throws Exception { + public void testLimitNumberOfRetainedTranslogFiles() throws Exception { String indexName = "test"; int translogRetentionTotalFiles = randomIntBetween(0, 50); Settings.Builder settings = Settings.builder() @@ -890,7 +890,7 @@ public class IndexShardIT extends ESSingleNodeTestCase { shard.rollTranslogGeneration(); } } - client().admin().indices().prepareFlush(indexName).get(); + client().admin().indices().prepareFlush(indexName).setForce(true).setWaitIfOngoing(true).get(); checkTranslog.run(); }