Skip to content

Commit e70887c

Browse files
committed
More detailed comment about throttling behaviour
1 parent c07131b commit e70887c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

server/src/main/java/org/elasticsearch/indices/PostRecoveryMerger.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
package org.elasticsearch.indices;
1111

12+
import org.apache.lucene.index.IndexWriter;
1213
import org.elasticsearch.action.ActionListener;
1314
import org.elasticsearch.cluster.node.DiscoveryNode;
1415
import org.elasticsearch.cluster.routing.ShardRouting;
@@ -55,17 +56,19 @@ class PostRecoveryMerger {
5556
}
5657
}
5758

59+
/**
60+
* Throttled runner to avoid multiple concurrent calls to {@link IndexWriter#maybeMerge()}: we do not need to execute these things
61+
* especially quickly, as long as they happen eventually, and each such call may involve some IO (reading the soft-deletes doc values to
62+
* count deleted docs). Note that we're not throttling any actual merges, just the checks to see what merges might be needed. Throttling
63+
* merges across shards is a separate issue, but normally this mechanism won't trigger any new merges anyway.
64+
*/
5865
private final ThrottledTaskRunner postRecoveryMergeRunner;
66+
5967
private final Function<ShardId, IndexShard> shardFunction;
6068
private final boolean enabled;
6169

6270
PostRecoveryMerger(Settings settings, Executor executor, Function<ShardId, IndexShard> shardFunction) {
63-
this.postRecoveryMergeRunner = new ThrottledTaskRunner(
64-
getClass().getCanonicalName(),
65-
// no need to execute these at high concurrency, we just need them to run eventually, so do them one-at-a-time
66-
1,
67-
executor
68-
);
71+
this.postRecoveryMergeRunner = new ThrottledTaskRunner(getClass().getCanonicalName(), 1, executor);
6972
this.shardFunction = shardFunction;
7073
this.enabled =
7174
// enabled globally ...

0 commit comments

Comments
 (0)