From 1fd8c64f1f842bad7d821c6624138c7c93a2d865 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Wed, 23 Sep 2015 22:22:25 +0200 Subject: [PATCH] [TEST] Add more logging to IndexShardTests#testMaybeFlush() --- .../main/java/org/elasticsearch/index/shard/IndexShard.java | 1 + .../java/org/elasticsearch/index/shard/IndexShardTests.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java b/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java index 8e6e143cb81..f19cc1d929e 100644 --- a/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java +++ b/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java @@ -1504,6 +1504,7 @@ public class IndexShard extends AbstractIndexShardComponent { // in that situation we have an extra unexpected flush. asyncFlushRunning.compareAndSet(true, false); } else { + logger.debug("submitting async flush request"); final AbstractRunnable abstractRunnable = new AbstractRunnable() { @Override public void onFailure(Throwable t) { diff --git a/core/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java b/core/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java index a65650c1b17..36984ec93e6 100644 --- a/core/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java +++ b/core/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java @@ -713,11 +713,14 @@ public class IndexShardTests extends ESSingleNodeTestCase { assertEquals(0, shard.engine().getTranslog().totalOperations()); shard.engine().getTranslog().sync(); 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) .put(IndexShard.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE, new ByteSizeValue(size, ByteSizeUnit.BYTES)) .build()).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 + logger.info("--> translog size on iter : [{}] num_ops [{}] generation [{}]", shard.engine().getTranslog().sizeInBytes(), shard.engine().getTranslog().totalOperations(), shard.engine().getTranslog().getGeneration()); assertFalse(shard.shouldFlush()); }); assertEquals(0, shard.engine().getTranslog().totalOperations());