From 8922d5b073a2e8e6706b644f86a1dcca3037483e Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Thu, 27 Oct 2011 02:14:47 +0200 Subject: [PATCH] Merge Scheduler: Allow to set index.merge.scheduler.max_merge_count, closes #1430. --- .../merge/scheduler/ConcurrentMergeSchedulerProvider.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/ConcurrentMergeSchedulerProvider.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/ConcurrentMergeSchedulerProvider.java index 7689f2f0782..5dcd371283e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/ConcurrentMergeSchedulerProvider.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/ConcurrentMergeSchedulerProvider.java @@ -44,6 +44,7 @@ import java.util.concurrent.CopyOnWriteArraySet; public class ConcurrentMergeSchedulerProvider extends AbstractIndexShardComponent implements MergeSchedulerProvider { private final int maxThreadCount; + private final int maxMergeCount; private Set schedulers = new CopyOnWriteArraySet(); @@ -52,11 +53,13 @@ public class ConcurrentMergeSchedulerProvider extends AbstractIndexShardComponen // TODO LUCENE MONITOR this will change in Lucene 4.0 this.maxThreadCount = componentSettings.getAsInt("max_thread_count", Math.max(1, Math.min(3, Runtime.getRuntime().availableProcessors() / 2))); + this.maxMergeCount = componentSettings.getAsInt("max_merge_count", maxThreadCount + 2); logger.debug("using [concurrent] merge scheduler with max_thread_count[{}]", maxThreadCount); } @Override public MergeScheduler newMergeScheduler() { CustomConcurrentMergeScheduler concurrentMergeScheduler = new CustomConcurrentMergeScheduler(logger, shardId, this); + concurrentMergeScheduler.setMaxMergeCount(maxMergeCount); concurrentMergeScheduler.setMaxThreadCount(maxThreadCount); schedulers.add(concurrentMergeScheduler); return concurrentMergeScheduler;