[TEST] Add more logging to IndexShardTests#testMaybeFlush()

This commit is contained in:
Simon Willnauer 2015-09-23 22:22:25 +02:00
parent 0f6e40ede1
commit 1fd8c64f1f
2 changed files with 4 additions and 0 deletions

View File

@ -1504,6 +1504,7 @@ public class IndexShard extends AbstractIndexShardComponent {
// in that situation we have an extra unexpected flush. // in that situation we have an extra unexpected flush.
asyncFlushRunning.compareAndSet(true, false); asyncFlushRunning.compareAndSet(true, false);
} else { } else {
logger.debug("submitting async flush request");
final AbstractRunnable abstractRunnable = new AbstractRunnable() { final AbstractRunnable abstractRunnable = new AbstractRunnable() {
@Override @Override
public void onFailure(Throwable t) { public void onFailure(Throwable t) {

View File

@ -713,11 +713,14 @@ public class IndexShardTests extends ESSingleNodeTestCase {
assertEquals(0, shard.engine().getTranslog().totalOperations()); assertEquals(0, shard.engine().getTranslog().totalOperations());
shard.engine().getTranslog().sync(); shard.engine().getTranslog().sync();
long size = shard.engine().getTranslog().sizeInBytes(); long size = shard.engine().getTranslog().sizeInBytes();
logger.info("--> current translog size: [{}] num_ops [{}] generation [{}]", shard.engine().getTranslog().sizeInBytes(), shard.engine().getTranslog().totalOperations(), shard.engine().getTranslog().getGeneration());
client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put(IndexShard.INDEX_TRANSLOG_FLUSH_THRESHOLD_OPS, 1000) client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put(IndexShard.INDEX_TRANSLOG_FLUSH_THRESHOLD_OPS, 1000)
.put(IndexShard.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE, new ByteSizeValue(size, ByteSizeUnit.BYTES)) .put(IndexShard.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE, new ByteSizeValue(size, ByteSizeUnit.BYTES))
.build()).get(); .build()).get();
client().prepareDelete("test", "test", "2").get(); client().prepareDelete("test", "test", "2").get();
logger.info("--> translog size after delete: [{}] num_ops [{}] generation [{}]", shard.engine().getTranslog().sizeInBytes(), shard.engine().getTranslog().totalOperations(), shard.engine().getTranslog().getGeneration());
assertBusy(() -> { // this is async assertBusy(() -> { // this is async
logger.info("--> translog size on iter : [{}] num_ops [{}] generation [{}]", shard.engine().getTranslog().sizeInBytes(), shard.engine().getTranslog().totalOperations(), shard.engine().getTranslog().getGeneration());
assertFalse(shard.shouldFlush()); assertFalse(shard.shouldFlush());
}); });
assertEquals(0, shard.engine().getTranslog().totalOperations()); assertEquals(0, shard.engine().getTranslog().totalOperations());