|
9 | 9 |
|
10 | 10 | package org.elasticsearch.indices;
|
11 | 11 |
|
| 12 | +import org.apache.lucene.index.IndexWriter; |
12 | 13 | import org.elasticsearch.action.ActionListener;
|
13 | 14 | import org.elasticsearch.cluster.node.DiscoveryNode;
|
14 | 15 | import org.elasticsearch.cluster.routing.ShardRouting;
|
@@ -55,17 +56,19 @@ class PostRecoveryMerger {
|
55 | 56 | }
|
56 | 57 | }
|
57 | 58 |
|
| 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 | + */ |
58 | 65 | private final ThrottledTaskRunner postRecoveryMergeRunner;
|
| 66 | + |
59 | 67 | private final Function<ShardId, IndexShard> shardFunction;
|
60 | 68 | private final boolean enabled;
|
61 | 69 |
|
62 | 70 | 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); |
69 | 72 | this.shardFunction = shardFunction;
|
70 | 73 | this.enabled =
|
71 | 74 | // enabled globally ...
|
|
0 commit comments