Skip to content

Commit 25cd835

Browse files
committed
Increase logging level for testStressMaybeFlush
Relates #31629
1 parent 88c270d commit 25cd835

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
import org.elasticsearch.test.ESSingleNodeTestCase;
7474
import org.elasticsearch.test.IndexSettingsModule;
7575
import org.elasticsearch.test.InternalSettingsPlugin;
76+
import org.elasticsearch.test.junit.annotations.TestLogging;
7677

7778
import java.io.IOException;
7879
import java.io.UncheckedIOException;
@@ -84,6 +85,7 @@
8485
import java.util.Collection;
8586
import java.util.Collections;
8687
import java.util.List;
88+
import java.util.Locale;
8789
import java.util.concurrent.BrokenBarrierException;
8890
import java.util.concurrent.CountDownLatch;
8991
import java.util.concurrent.CyclicBarrier;
@@ -404,6 +406,7 @@ public void testMaybeRollTranslogGeneration() throws Exception {
404406
}
405407
}
406408

409+
@TestLogging("_root:DEBUG,org.elasticsearch.index.shard:TRACE,org.elasticsearch.index.engine:TRACE")
407410
public void testStressMaybeFlushOrRollTranslogGeneration() throws Exception {
408411
createIndex("test");
409412
ensureGreen();
@@ -446,13 +449,14 @@ public void testStressMaybeFlushOrRollTranslogGeneration() throws Exception {
446449
barrier.await();
447450
final CheckedRunnable<Exception> check;
448451
if (flush) {
449-
final FlushStats flushStats = shard.flushStats();
450-
final long total = flushStats.getTotal();
451-
final long periodic = flushStats.getPeriodic();
452+
final FlushStats initialStats = shard.flushStats();
452453
client().prepareIndex("test", "test", "1").setSource("{}", XContentType.JSON).get();
453454
check = () -> {
454-
assertThat(shard.flushStats().getTotal(), equalTo(total + 1));
455-
assertThat(shard.flushStats().getPeriodic(), equalTo(periodic + 1));
455+
final FlushStats currentStats = shard.flushStats();
456+
String msg = String.format(Locale.ROOT, "flush stats: total=[%d vs %d], periodic=[%d vs %d]",
457+
initialStats.getTotal(), currentStats.getTotal(), initialStats.getPeriodic(), currentStats.getPeriodic());
458+
assertThat(msg, currentStats.getPeriodic(), equalTo(initialStats.getPeriodic() + 1));
459+
assertThat(msg, currentStats.getTotal(), equalTo(initialStats.getTotal() + 1));
456460
};
457461
} else {
458462
final long generation = getTranslog(shard).currentFileGeneration();

0 commit comments

Comments
 (0)