Commit cf9953f
committed
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.1 parent 61b6a9b commit cf9953f
File tree
61 files changed
+462
-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
- test
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
+462
-515
lines changedLines changed: 48 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
82 | 95 | | |
83 | 96 | | |
84 | 97 | | |
85 | 98 | | |
| 99 | + | |
| 100 | + | |
86 | 101 | | |
87 | 102 | | |
88 | 103 | | |
| |||
94 | 109 | | |
95 | 110 | | |
96 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
97 | 116 | | |
98 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
99 | 120 | | |
100 | 121 | | |
101 | | - | |
| 122 | + | |
| 123 | + | |
102 | 124 | | |
103 | 125 | | |
104 | 126 | | |
| |||
215 | 237 | | |
216 | 238 | | |
217 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
218 | 244 | | |
219 | 245 | | |
220 | 246 | | |
| |||
282 | 308 | | |
283 | 309 | | |
284 | 310 | | |
| 311 | + | |
285 | 312 | | |
286 | | - | |
| 313 | + | |
| 314 | + | |
287 | 315 | | |
288 | 316 | | |
289 | 317 | | |
| 318 | + | |
290 | 319 | | |
291 | 320 | | |
292 | 321 | | |
| |||
380 | 409 | | |
381 | 410 | | |
382 | 411 | | |
383 | | - | |
| 412 | + | |
384 | 413 | | |
385 | 414 | | |
386 | 415 | | |
| |||
511 | 540 | | |
512 | 541 | | |
513 | 542 | | |
| 543 | + | |
| 544 | + | |
514 | 545 | | |
515 | | - | |
| 546 | + | |
| 547 | + | |
516 | 548 | | |
517 | 549 | | |
| 550 | + | |
| 551 | + | |
518 | 552 | | |
519 | 553 | | |
520 | 554 | | |
| |||
589 | 623 | | |
590 | 624 | | |
591 | 625 | | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
592 | 635 | | |
593 | 636 | | |
594 | 637 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | 112 | | |
114 | 113 | | |
115 | 114 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
213 | 214 | | |
214 | 215 | | |
215 | 216 | | |
| 217 | + | |
216 | 218 | | |
217 | 219 | | |
218 | 220 | | |
| |||
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 | | |
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | | - | |
| 117 | + | |
119 | 118 | | |
120 | 119 | | |
121 | 120 | | |
| |||
133 | 132 | | |
134 | 133 | | |
135 | 134 | | |
136 | | - | |
137 | | - | |
| 135 | + | |
138 | 136 | | |
139 | 137 | | |
140 | 138 | | |
| |||
163 | 161 | | |
164 | 162 | | |
165 | 163 | | |
166 | | - | |
167 | | - | |
| 164 | + | |
168 | 165 | | |
169 | 166 | | |
170 | 167 | | |
| |||
198 | 195 | | |
199 | 196 | | |
200 | 197 | | |
201 | | - | |
202 | | - | |
| 198 | + | |
203 | 199 | | |
204 | 200 | | |
205 | 201 | | |
| |||
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 | | |
| |||
Lines changed: 8 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| |||
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
60 | | - | |
61 | 59 | | |
62 | 60 | | |
63 | 61 | | |
| |||
89 | 87 | | |
90 | 88 | | |
91 | 89 | | |
92 | | - | |
| 90 | + | |
93 | 91 | | |
94 | 92 | | |
95 | 93 | | |
| |||
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
124 | | - | |
| 122 | + | |
125 | 123 | | |
126 | 124 | | |
127 | 125 | | |
| |||
165 | 163 | | |
166 | 164 | | |
167 | 165 | | |
168 | | - | |
| 166 | + | |
169 | 167 | | |
170 | 168 | | |
171 | 169 | | |
172 | 170 | | |
173 | 171 | | |
174 | 172 | | |
175 | | - | |
| 173 | + | |
176 | 174 | | |
177 | 175 | | |
178 | 176 | | |
179 | 177 | | |
180 | 178 | | |
181 | 179 | | |
182 | 180 | | |
183 | | - | |
| 181 | + | |
184 | 182 | | |
185 | 183 | | |
186 | 184 | | |
| |||
192 | 190 | | |
193 | 191 | | |
194 | 192 | | |
195 | | - | |
196 | | - | |
| 193 | + | |
197 | 194 | | |
198 | | - | |
199 | | - | |
| 195 | + | |
200 | 196 | | |
201 | 197 | | |
202 | 198 | | |
| |||
0 commit comments