Commit be05ca6
committed
Defer reroute when starting shards (elastic#44433)
* Defer reroute when starting shards
Today we reroute the cluster as part of the process of starting a shard, which
runs at `URGENT` priority. In large clusters, rerouting may take some time to
complete, and this means that a mere trickle of shard-started events can cause
starvation for other, lower-priority, tasks that are pending on the master.
However, it isn't really necessary to perform a reroute when starting a shard,
as long as one occurs eventually. This commit removes the inline reroute from
the process of starting a shard and replaces it with a deferred one that runs
at `NORMAL` priority, avoiding starvation of higher-priority tasks.
This may improve some of the situations related to elastic#42738 and elastic#42105.
* Specific test case for followup priority setting
We cannot set the priority in all InternalTestClusters because the deprecation
warning makes some tests unhappy. This commit adds a specific test instead.
* Checkstyle
* Cluster state always changed here
* Assert consistency of routing nodes
* Restrict setting only to reasonable priorities1 parent a5ad594 commit be05ca6
File tree
61 files changed
+605
-515
lines changed- server/src
- main/java/org/elasticsearch
- cluster
- action/shard
- routing/allocation
- common/settings
- test/java/org/elasticsearch
- action
- admin/indices/shrink
- support/replication
- cluster
- action/shard
- metadata
- routing
- allocation
- decider
- structure
- indexlifecycle
- indices/cluster
- test/framework/src/main/java/org/elasticsearch/cluster
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
61 files changed
+605
-515
lines changedLines changed: 57 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| 76 | + | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
| |||
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
85 | 109 | | |
86 | 110 | | |
87 | 111 | | |
88 | 112 | | |
| 113 | + | |
| 114 | + | |
89 | 115 | | |
90 | 116 | | |
91 | 117 | | |
| |||
97 | 123 | | |
98 | 124 | | |
99 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
100 | 130 | | |
101 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
102 | 134 | | |
103 | 135 | | |
104 | | - | |
| 136 | + | |
| 137 | + | |
105 | 138 | | |
106 | 139 | | |
107 | 140 | | |
| |||
218 | 251 | | |
219 | 252 | | |
220 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
221 | 258 | | |
222 | 259 | | |
223 | 260 | | |
| |||
285 | 322 | | |
286 | 323 | | |
287 | 324 | | |
| 325 | + | |
288 | 326 | | |
289 | | - | |
| 327 | + | |
| 328 | + | |
290 | 329 | | |
291 | 330 | | |
292 | 331 | | |
| 332 | + | |
293 | 333 | | |
294 | 334 | | |
295 | 335 | | |
| |||
383 | 423 | | |
384 | 424 | | |
385 | 425 | | |
386 | | - | |
| 426 | + | |
387 | 427 | | |
388 | 428 | | |
389 | 429 | | |
| |||
520 | 560 | | |
521 | 561 | | |
522 | 562 | | |
| 563 | + | |
| 564 | + | |
523 | 565 | | |
524 | | - | |
| 566 | + | |
| 567 | + | |
525 | 568 | | |
526 | 569 | | |
| 570 | + | |
| 571 | + | |
527 | 572 | | |
528 | 573 | | |
529 | 574 | | |
| |||
598 | 643 | | |
599 | 644 | | |
600 | 645 | | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
601 | 653 | | |
602 | 654 | | |
603 | 655 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
| 231 | + | |
230 | 232 | | |
231 | 233 | | |
232 | 234 | | |
| |||
server/src/test/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeActionTests.java
Lines changed: 5 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
| 119 | + | |
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
| |||
135 | 134 | | |
136 | 135 | | |
137 | 136 | | |
138 | | - | |
139 | | - | |
| 137 | + | |
140 | 138 | | |
141 | 139 | | |
142 | 140 | | |
| |||
165 | 163 | | |
166 | 164 | | |
167 | 165 | | |
168 | | - | |
169 | | - | |
| 166 | + | |
170 | 167 | | |
171 | 168 | | |
172 | 169 | | |
| |||
200 | 197 | | |
201 | 198 | | |
202 | 199 | | |
203 | | - | |
204 | | - | |
| 200 | + | |
205 | 201 | | |
206 | 202 | | |
207 | 203 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
469 | | - | |
| 469 | + | |
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
| |||
0 commit comments