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 35b7af704dc47..16c85073760f4 100644 --- a/server/src/test/java/org/elasticsearch/index/shard/IndexShardIT.java +++ b/server/src/test/java/org/elasticsearch/index/shard/IndexShardIT.java @@ -368,8 +368,8 @@ public void testMaybeFlush() throws Exception { assertFalse(shard.shouldPeriodicallyFlush()); assertThat(shard.flushStats().getPeriodic(), greaterThan(0L)); }); + shard.sync(); assertEquals(0, translog.stats().getUncommittedOperations()); - translog.sync(); long size = Math.max(translog.stats().getUncommittedSizeInBytes(), Translog.DEFAULT_HEADER_SIZE_IN_BYTES + 1); logger.info("--> current translog size: [{}] num_ops [{}] generation [{}]", translog.stats().getUncommittedSizeInBytes(), translog.stats().getUncommittedOperations(), translog.getGeneration()); @@ -388,6 +388,7 @@ public void testMaybeFlush() throws Exception { commitStats.getUserData(), flushStats.getPeriodic(), flushStats.getTotal()); assertFalse(shard.shouldPeriodicallyFlush()); }); + shard.sync(); assertEquals(0, translog.stats().getUncommittedOperations()); }