Commit 1c119b6
authored
This change fixes a bug that causes a deadlock in the thread pool merge scheduler when a merge fails due to a tragic event.
The deadlock occurs because Lucene aborts running merges when failing with a tragic event and then waits for them to complete. But those "running" merges might in fact be waiting in the Elasticsearch's thread pool merge scheduler tasks queue, or they might be waiting in the backlogged merge tasks queue because the per-shard concurrent merges count limit has been reached, or they might simply be waiting for enough disk space to be executed. In which cases the merge thread that is failing waits indefinitely.
The proposed fix in this change uses the merge thread that is failing due to a tragic event to abort all other enqueued and backlogged merge tasks of the same shard, before pursuing with the closing of the IndexWriter. This way Lucene won't have to wait for any running merges as they would have all be aborted upfront.
Backport of #134656 for 9.0.8
Relates ES-12664
1 parent 6b3b519 commit 1c119b6
File tree
7 files changed
+716
-34
lines changed- docs/changelog
- server/src
- internalClusterTest/java/org/elasticsearch/index/engine
- main/java/org/elasticsearch/index
- engine
- shard
- test/framework/src/main/java/org/elasticsearch/index/engine
7 files changed
+716
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 463 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 42 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2682 | 2682 | | |
2683 | 2683 | | |
2684 | 2684 | | |
2685 | | - | |
2686 | | - | |
2687 | | - | |
2688 | | - | |
2689 | | - | |
| 2685 | + | |
2690 | 2686 | | |
2691 | 2687 | | |
2692 | 2688 | | |
| |||
2822 | 2818 | | |
2823 | 2819 | | |
2824 | 2820 | | |
2825 | | - | |
2826 | | - | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
2827 | 2825 | | |
2828 | 2826 | | |
2829 | 2827 | | |
| |||
3280 | 3278 | | |
3281 | 3279 | | |
3282 | 3280 | | |
3283 | | - | |
3284 | | - | |
3285 | | - | |
| 3281 | + | |
| 3282 | + | |
| 3283 | + | |
| 3284 | + | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
3286 | 3288 | | |
3287 | 3289 | | |
3288 | 3290 | | |
3289 | | - | |
3290 | | - | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
3291 | 3308 | | |
3292 | 3309 | | |
3293 | 3310 | | |
3294 | | - | |
3295 | | - | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
3296 | 3324 | | |
3297 | 3325 | | |
3298 | 3326 | | |
| |||
Lines changed: 43 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
372 | 375 | | |
373 | 376 | | |
374 | 377 | | |
375 | | - | |
| 378 | + | |
376 | 379 | | |
377 | 380 | | |
378 | 381 | | |
| |||
385 | 388 | | |
386 | 389 | | |
387 | 390 | | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
388 | 410 | | |
389 | 411 | | |
390 | 412 | | |
| |||
675 | 697 | | |
676 | 698 | | |
677 | 699 | | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
678 | 719 | | |
679 | 720 | | |
680 | 721 | | |
| |||
704 | 745 | | |
705 | 746 | | |
706 | 747 | | |
707 | | - | |
| 748 | + | |
708 | 749 | | |
709 | 750 | | |
710 | 751 | | |
| |||
0 commit comments