Skip to content

Commit 5cbd7f7

Browse files
committed
Log flush_stats and commit_stats in testMaybeFlush
This test failed a few times over the last several months. It seems that we triggered a flush, but CI was too slow to finish it in several seconds. I added the flush stats and commit stats and unmuted this test. We should have a good clue if this test fails again. Relates #37896
1 parent c21d385 commit 5cbd7f7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.elasticsearch.cluster.routing.UnassignedInfo;
4141
import org.elasticsearch.cluster.service.ClusterService;
4242
import org.elasticsearch.common.CheckedRunnable;
43+
import org.elasticsearch.common.Strings;
4344
import org.elasticsearch.common.UUIDs;
4445
import org.elasticsearch.common.breaker.CircuitBreaker;
4546
import org.elasticsearch.common.bytes.BytesArray;
@@ -57,12 +58,14 @@
5758
import org.elasticsearch.index.IndexService;
5859
import org.elasticsearch.index.IndexSettings;
5960
import org.elasticsearch.index.VersionType;
61+
import org.elasticsearch.index.engine.CommitStats;
6062
import org.elasticsearch.index.engine.Engine;
6163
import org.elasticsearch.index.engine.SegmentsStats;
6264
import org.elasticsearch.index.flush.FlushStats;
6365
import org.elasticsearch.index.mapper.SourceToParse;
6466
import org.elasticsearch.index.seqno.SequenceNumbers;
6567
import org.elasticsearch.index.translog.Translog;
68+
import org.elasticsearch.index.translog.TranslogStats;
6669
import org.elasticsearch.indices.IndicesService;
6770
import org.elasticsearch.indices.breaker.CircuitBreakerService;
6871
import org.elasticsearch.indices.breaker.CircuitBreakerStats;
@@ -337,7 +340,6 @@ public void testIndexCanChangeCustomDataPath() throws Exception {
337340
assertPathHasBeenCleared(endDir.toAbsolutePath());
338341
}
339342

340-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37896")
341343
public void testMaybeFlush() throws Exception {
342344
createIndex("test", Settings.builder().put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.REQUEST)
343345
.build());
@@ -376,8 +378,12 @@ public void testMaybeFlush() throws Exception {
376378
logger.info("--> translog size after delete: [{}] num_ops [{}] generation [{}]",
377379
translog.stats().getUncommittedSizeInBytes(), translog.stats().getUncommittedOperations(), translog.getGeneration());
378380
assertBusy(() -> { // this is async
379-
logger.info("--> translog size on iter : [{}] num_ops [{}] generation [{}]",
380-
translog.stats().getUncommittedSizeInBytes(), translog.stats().getUncommittedOperations(), translog.getGeneration());
381+
final TranslogStats translogStats = translog.stats();
382+
final CommitStats commitStats = shard.commitStats();
383+
final FlushStats flushStats = shard.flushStats();
384+
logger.info("--> translog stats [{}] gen [{}] commit_stats [{}] flush_stats [{}/{}]",
385+
Strings.toString(translogStats), translog.getGeneration().translogFileGeneration,
386+
commitStats.getUserData(), flushStats.getPeriodic(), flushStats.getTotal());
381387
assertFalse(shard.shouldPeriodicallyFlush());
382388
});
383389
assertEquals(0, translog.stats().getUncommittedOperations());

0 commit comments

Comments
 (0)