Skip to content

Commit

Permalink
Increase logging level for testStressMaybeFlush
Browse files Browse the repository at this point in the history
Relates #31629
  • Loading branch information
dnhatn committed Jul 10, 2018
1 parent 27c74d8 commit 030f406
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.test.IndexSettingsModule;
import org.elasticsearch.test.InternalSettingsPlugin;
import org.elasticsearch.test.junit.annotations.TestLogging;

import java.io.IOException;
import java.io.UncheckedIOException;
Expand All @@ -81,6 +82,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.atomic.AtomicBoolean;
Expand Down Expand Up @@ -398,6 +400,7 @@ public void testMaybeRollTranslogGeneration() throws Exception {
}
}

@TestLogging("_root:DEBUG,org.elasticsearch.index.shard:TRACE,org.elasticsearch.index.engine:TRACE")
public void testStressMaybeFlushOrRollTranslogGeneration() throws Exception {
createIndex("test");
ensureGreen();
Expand Down Expand Up @@ -440,13 +443,14 @@ public void testStressMaybeFlushOrRollTranslogGeneration() throws Exception {
barrier.await();
final CheckedRunnable<Exception> check;
if (flush) {
final FlushStats flushStats = shard.flushStats();
final long total = flushStats.getTotal();
final long periodic = flushStats.getPeriodic();
final FlushStats initialStats = shard.flushStats();
client().prepareIndex("test", "test", "1").setSource("{}", XContentType.JSON).get();
check = () -> {
assertThat(shard.flushStats().getTotal(), equalTo(total + 1));
assertThat(shard.flushStats().getPeriodic(), equalTo(periodic + 1));
final FlushStats currentStats = shard.flushStats();
String msg = String.format(Locale.ROOT, "flush stats: total=[%d vs %d], periodic=[%d vs %d]",
initialStats.getTotal(), currentStats.getTotal(), initialStats.getPeriodic(), currentStats.getPeriodic());
assertThat(msg, currentStats.getPeriodic(), equalTo(initialStats.getPeriodic() + 1));
assertThat(msg, currentStats.getTotal(), equalTo(initialStats.getTotal() + 1));
};
} else {
final long generation = getTranslog(shard).currentFileGeneration();
Expand Down

0 comments on commit 030f406

Please sign in to comment.