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
This commit is contained in:
Nhat Nguyen 2019-01-30 12:28:24 -05:00
parent 2cbc6888a2
commit ed460c2815
1 changed files with 9 additions and 3 deletions

View File

@ -42,6 +42,7 @@ import org.elasticsearch.cluster.routing.TestShardRouting;
import org.elasticsearch.cluster.routing.UnassignedInfo;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.CheckedRunnable;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.UUIDs;
import org.elasticsearch.common.breaker.CircuitBreaker;
import org.elasticsearch.common.bytes.BytesArray;
@ -59,6 +60,7 @@ import org.elasticsearch.index.Index;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.VersionType;
import org.elasticsearch.index.engine.CommitStats;
import org.elasticsearch.index.engine.Engine;
import org.elasticsearch.index.engine.SegmentsStats;
import org.elasticsearch.index.flush.FlushStats;
@ -66,6 +68,7 @@ import org.elasticsearch.index.mapper.SourceToParse;
import org.elasticsearch.index.seqno.SequenceNumbers;
import org.elasticsearch.index.translog.TestTranslog;
import org.elasticsearch.index.translog.Translog;
import org.elasticsearch.index.translog.TranslogStats;
import org.elasticsearch.indices.IndicesService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.indices.breaker.CircuitBreakerStats;
@ -342,7 +345,6 @@ public class IndexShardIT extends ESSingleNodeTestCase {
assertPathHasBeenCleared(endDir.toAbsolutePath());
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37896")
public void testMaybeFlush() throws Exception {
createIndex("test", Settings.builder().put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.REQUEST)
.build());
@ -381,8 +383,12 @@ public class IndexShardIT extends ESSingleNodeTestCase {
logger.info("--> translog size after delete: [{}] num_ops [{}] generation [{}]",
translog.stats().getUncommittedSizeInBytes(), translog.stats().getUncommittedOperations(), translog.getGeneration());
assertBusy(() -> { // this is async
logger.info("--> translog size on iter : [{}] num_ops [{}] generation [{}]",
translog.stats().getUncommittedSizeInBytes(), translog.stats().getUncommittedOperations(), translog.getGeneration());
final TranslogStats translogStats = translog.stats();
final CommitStats commitStats = shard.commitStats();
final FlushStats flushStats = shard.flushStats();
logger.info("--> translog stats [{}] gen [{}] commit_stats [{}] flush_stats [{}/{}]",
Strings.toString(translogStats), translog.getGeneration().translogFileGeneration,
commitStats.getUserData(), flushStats.getPeriodic(), flushStats.getTotal());
assertFalse(shard.shouldPeriodicallyFlush());
});
assertEquals(0, translog.stats().getUncommittedOperations());