From 73dec5d63f152336fbbb53209f21fa91b0b6bf41 Mon Sep 17 00:00:00 2001 From: kimchy Date: Sat, 12 Mar 2011 17:03:04 +0200 Subject: [PATCH] Add `max_shard_index_buffer_size` to control the upper limit of a shard indexing buffer size (defaults to `512mb`), closes #773. --- .../indices/memory/IndexingMemoryBufferController.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 8729042d38e..322945d7265 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 @@ -40,6 +40,7 @@ public class IndexingMemoryBufferController extends AbstractComponent { private final ByteSizeValue indexingBuffer; private final ByteSizeValue minShardIndexBufferSize; + private final ByteSizeValue maxShardIndexBufferSize; private final IndicesService indicesService; @@ -69,8 +70,9 @@ public class IndexingMemoryBufferController extends AbstractComponent { this.indexingBuffer = indexingBuffer; this.minShardIndexBufferSize = componentSettings.getAsBytesSize("min_shard_index_buffer_size", new ByteSizeValue(4, ByteSizeUnit.MB)); + this.maxShardIndexBufferSize = componentSettings.getAsBytesSize("max_shard_index_buffer_size", new ByteSizeValue(512, ByteSizeUnit.MB)); - logger.debug("using index_buffer_size [{}], with min_shard_index_buffer_size [{}]", this.indexingBuffer, this.minShardIndexBufferSize); + logger.debug("using index_buffer_size [{}], with min_shard_index_buffer_size [{}], max_shard_index_buffer_size [{}]", this.indexingBuffer, this.minShardIndexBufferSize, this.maxShardIndexBufferSize); indicesService.indicesLifecycle().addListener(listener); } @@ -97,6 +99,9 @@ public class IndexingMemoryBufferController extends AbstractComponent { if (shardIndexingBufferSize.bytes() < minShardIndexBufferSize.bytes()) { shardIndexingBufferSize = minShardIndexBufferSize; } + if (shardIndexingBufferSize.bytes() > maxShardIndexBufferSize.bytes()) { + shardIndexingBufferSize = maxShardIndexBufferSize; + } logger.debug("recalculating shard indexing buffer (reason={}), total is [{}] with [{}] shards, each shard set to [{}]", reason, indexingBuffer, shardsCount, shardIndexingBufferSize); for (IndexService indexService : indicesService) { for (IndexShard indexShard : indexService) {