Skip to content

Commit 9e467a1

Browse files
Indexing throttling !
1 parent 7b68ba9 commit 9e467a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/src/main/java/org/elasticsearch/index/engine/ThreadPoolMergeScheduler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,16 @@ private void maybeExecuteNextMerge() {
178178
}
179179

180180
private void maybeActivateThrottling() {
181-
int numActiveMerges = activeMergeTasksExecutingOnLocalSchedulerList.size();
181+
// both currently running and enqueued count as "active" for throttling purposes
182+
int numActiveMerges = activeMergeTasksExecutingOnLocalSchedulerList.size() + activeMergeTasksLocalSchedulerQueue.size();
182183
if (numActiveMerges > config.getMaxMergeCount() && isThrottling.getAndSet(true) == false) {
183184
activateThrottling(numActiveMerges);
184185
}
185186
}
186187

187188
private void maybeDeactivateThrottling() {
188-
int numActiveMerges = activeMergeTasksExecutingOnLocalSchedulerList.size();
189+
// both currently running and enqueued count as "active" for throttling purposes
190+
int numActiveMerges = activeMergeTasksExecutingOnLocalSchedulerList.size() + activeMergeTasksLocalSchedulerQueue.size();
189191
if (numActiveMerges <= config.getMaxMergeCount() && isThrottling.getAndSet(false)) {
190192
deactivateThrottling(numActiveMerges);
191193
}

0 commit comments

Comments
 (0)