Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ interface UpdateConsumer {
}
}

public boolean usingMaxTargetIORateBytesPerSec() {
return MAX_IO_RATE.getBytes() == targetIORateBytesPerSec.get();
}

// exposed for tests
Set<MergeTask> getRunningMergeTasks() {
return runningMergeTasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,21 +191,25 @@ private void checkMergeTaskThrottling() {
int configuredMaxMergeCount = config.getMaxMergeCount();
// both currently running and enqueued merge tasks are considered "active" for throttling purposes
int activeMerges = (int) (submittedMergesCount - doneMergesCount);
if (activeMerges > configuredMaxMergeCount && shouldThrottleIncomingMerges.get() == false) {
if (activeMerges > configuredMaxMergeCount
&& threadPoolMergeExecutorService.usingMaxTargetIORateBytesPerSec()
&& shouldThrottleIncomingMerges.get() == false) {
// maybe enable merge task throttling
synchronized (shouldThrottleIncomingMerges) {
if (shouldThrottleIncomingMerges.getAndSet(true) == false) {
enableIndexingThrottling(runningMergesCount, activeMerges - runningMergesCount, configuredMaxMergeCount);
}
}
} else if (activeMerges <= configuredMaxMergeCount && shouldThrottleIncomingMerges.get()) {
// maybe disable merge task throttling
synchronized (shouldThrottleIncomingMerges) {
if (shouldThrottleIncomingMerges.getAndSet(false)) {
disableIndexingThrottling(runningMergesCount, activeMerges - runningMergesCount, configuredMaxMergeCount);
} else if (activeMerges <= configuredMaxMergeCount
&& threadPoolMergeExecutorService.usingMaxTargetIORateBytesPerSec() == false
&& shouldThrottleIncomingMerges.get()) {
// maybe disable merge task throttling
synchronized (shouldThrottleIncomingMerges) {
if (shouldThrottleIncomingMerges.getAndSet(false)) {
disableIndexingThrottling(runningMergesCount, activeMerges - runningMergesCount, configuredMaxMergeCount);
}
}
}
}
}

// exposed for tests
Expand Down