Commit aefb309
authored
Fail realtime get request if it is stale due to resharding (elastic#141604)
During resharding, a get request may become stale if the shard
that owns the requested document changes between the time that
the request is formed and when it is processed. We can detect
whether this has happened by comparing the current routing of
the document based on the routing table to the shard that has
actually processed the document. If there is a mismatch, we
fail the request.
Later this failure should be handled by internally retrying the
request with a fresh route, but for correctness we do need to
start by rejecting the request if it has been routed to the
wrong shard.1 parent f959a06 commit aefb309
File tree
6 files changed
+76
-32
lines changed- server/src
- main/java/org/elasticsearch
- action/get
- cluster/routing
- index/get
- test/java/org/elasticsearch
- cluster/routing
- index/shard
6 files changed
+76
-32
lines changedLines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
78 | | - | |
| 79 | + | |
| 80 | + | |
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
| 279 | + | |
| 280 | + | |
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
| |||
Lines changed: 22 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
| 225 | + | |
240 | 226 | | |
241 | 227 | | |
242 | 228 | | |
243 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
247 | 248 | | |
248 | 249 | | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
| 250 | + | |
253 | 251 | | |
254 | | - | |
| 252 | + | |
| 253 | + | |
255 | 254 | | |
256 | 255 | | |
257 | 256 | | |
| |||
272 | 271 | | |
273 | 272 | | |
274 | 273 | | |
275 | | - | |
| 274 | + | |
| 275 | + | |
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| |||
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
850 | 850 | | |
851 | 851 | | |
852 | 852 | | |
853 | | - | |
| 853 | + | |
854 | 854 | | |
855 | 855 | | |
856 | 856 | | |
| |||
885 | 885 | | |
886 | 886 | | |
887 | 887 | | |
| 888 | + | |
888 | 889 | | |
889 | 890 | | |
890 | 891 | | |
| |||
903 | 904 | | |
904 | 905 | | |
905 | 906 | | |
906 | | - | |
| 907 | + | |
907 | 908 | | |
| 909 | + | |
908 | 910 | | |
909 | 911 | | |
910 | 912 | | |
| |||
926 | 928 | | |
927 | 929 | | |
928 | 930 | | |
| 931 | + | |
929 | 932 | | |
930 | 933 | | |
931 | 934 | | |
| |||
Lines changed: 42 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
366 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
367 | 376 | | |
368 | 377 | | |
369 | 378 | | |
| |||
387 | 396 | | |
388 | 397 | | |
389 | 398 | | |
390 | | - | |
| 399 | + | |
| 400 | + | |
391 | 401 | | |
392 | 402 | | |
393 | 403 | | |
| |||
413 | 423 | | |
414 | 424 | | |
415 | 425 | | |
416 | | - | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
417 | 436 | | |
418 | 437 | | |
419 | 438 | | |
420 | | - | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
421 | 449 | | |
422 | 450 | | |
423 | 451 | | |
| |||
435 | 463 | | |
436 | 464 | | |
437 | 465 | | |
438 | | - | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
439 | 476 | | |
440 | 477 | | |
441 | 478 | | |
| |||
0 commit comments