diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/memory/IndexingMemoryBufferController.java b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/memory/IndexingMemoryBufferController.java index 57889bf8702..2c62cb68142 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/memory/IndexingMemoryBufferController.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/memory/IndexingMemoryBufferController.java @@ -141,7 +141,8 @@ public class IndexingMemoryBufferController extends AbstractLifecycleComponent inactiveTime.millis()) { + // mark it as inactive only if enough time has passed and there are no ongoing merges going on... + if ((time - status.time) > inactiveTime.millis() && ((InternalIndexShard) indexShard).mergeScheduler().stats().current() == 0) { try { ((InternalIndexShard) indexShard).engine().updateIndexingBufferSize(Engine.INACTIVE_SHARD_INDEXING_BUFFER); } catch (EngineClosedException e) { @@ -154,14 +155,14 @@ public class IndexingMemoryBufferController extends AbstractLifecycleComponent