|
73 | 73 | import org.elasticsearch.test.ESSingleNodeTestCase;
|
74 | 74 | import org.elasticsearch.test.IndexSettingsModule;
|
75 | 75 | import org.elasticsearch.test.InternalSettingsPlugin;
|
| 76 | +import org.elasticsearch.test.junit.annotations.TestLogging; |
76 | 77 |
|
77 | 78 | import java.io.IOException;
|
78 | 79 | import java.io.UncheckedIOException;
|
|
84 | 85 | import java.util.Collection;
|
85 | 86 | import java.util.Collections;
|
86 | 87 | import java.util.List;
|
| 88 | +import java.util.Locale; |
87 | 89 | import java.util.concurrent.BrokenBarrierException;
|
88 | 90 | import java.util.concurrent.CountDownLatch;
|
89 | 91 | import java.util.concurrent.CyclicBarrier;
|
@@ -404,6 +406,7 @@ public void testMaybeRollTranslogGeneration() throws Exception {
|
404 | 406 | }
|
405 | 407 | }
|
406 | 408 |
|
| 409 | + @TestLogging("_root:DEBUG,org.elasticsearch.index.shard:TRACE,org.elasticsearch.index.engine:TRACE") |
407 | 410 | public void testStressMaybeFlushOrRollTranslogGeneration() throws Exception {
|
408 | 411 | createIndex("test");
|
409 | 412 | ensureGreen();
|
@@ -446,13 +449,14 @@ public void testStressMaybeFlushOrRollTranslogGeneration() throws Exception {
|
446 | 449 | barrier.await();
|
447 | 450 | final CheckedRunnable<Exception> check;
|
448 | 451 | 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(); |
452 | 453 | client().prepareIndex("test", "test", "1").setSource("{}", XContentType.JSON).get();
|
453 | 454 | 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)); |
456 | 460 | };
|
457 | 461 | } else {
|
458 | 462 | final long generation = getTranslog(shard).currentFileGeneration();
|
|
0 commit comments