From 6731e9f9c8dc58701cb952bec830a54e20e5b417 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 4fc3793d64e0d..c2ce622082faf 100644 --- a/server/src/test/java/org/elasticsearch/index/shard/IndexShardIT.java +++ b/server/src/test/java/org/elasticsearch/index/shard/IndexShardIT.java @@ -855,7 +855,7 @@ public void testNoOpEngineFactoryTakesPrecedence() { } } - public void testLimitNumberOfRetainingTranslogFiles() throws Exception { + public void testLimitNumberOfRetainedTranslogFiles() throws Exception { String indexName = "test"; int translogRetentionTotalFiles = randomIntBetween(0, 50); Settings.Builder settings = Settings.builder() @@ -888,7 +888,7 @@ public void testLimitNumberOfRetainingTranslogFiles() throws Exception { shard.rollTranslogGeneration(); } } - client().admin().indices().prepareFlush(indexName).get(); + client().admin().indices().prepareFlush(indexName).setForce(true).setWaitIfOngoing(true).get(); checkTranslog.run(); }