Add `max_shard_index_buffer_size` to control the upper limit of a shard indexing buffer size (defaults to `512mb`), closes #773.

This commit is contained in:
kimchy 2011-03-12 17:03:04 +02:00
parent 19052a3538
commit 73dec5d63f
1 changed files with 6 additions and 1 deletions

View File

@ -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) {