Skip to content

Commit 19cdd0c

Browse files
committed
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
1 parent 98e80e6 commit 19cdd0c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/src/test/java/org/elasticsearch/index/shard/IndexShardIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ public void testRoutingRequiresTypeless() throws IOException {
842842
client().prepareUpdate("index", "_doc", "1").setDoc()::get);
843843
}
844844

845-
public void testLimitNumberOfRetainingTranslogFiles() throws Exception {
845+
public void testLimitNumberOfRetainedTranslogFiles() throws Exception {
846846
String indexName = "test";
847847
int translogRetentionTotalFiles = randomIntBetween(0, 50);
848848
Settings.Builder settings = Settings.builder()
@@ -874,7 +874,7 @@ public void testLimitNumberOfRetainingTranslogFiles() throws Exception {
874874
getEngine(shard).rollTranslogGeneration();
875875
}
876876
}
877-
client().admin().indices().prepareFlush(indexName).get();
877+
client().admin().indices().prepareFlush(indexName).setForce(true).setWaitIfOngoing(true).get();
878878
checkTranslog.run();
879879
}
880880
}

0 commit comments

Comments
 (0)