- Notifications
You must be signed in to change notification settings - Fork28
Commit0f8977b
committed
Detect the deadlocks between backends and the startup process.
The deadlocks that the recovery conflict on lock is involved in canhappen between hot-standby backends and the startup process.If a backend takes an access exclusive lock on the table and whichfinally triggers the deadlock, that deadlock can be detectedas expected. On the other hand, previously, if the startup processtook an access exclusive lock and which finally triggered the deadlock,that deadlock could not be detected and could remain even afterdeadlock_timeout passed. This is a bug.The cause of this bug was that the code for handling the recoveryconflict on lock didn't take care of deadlock case at all. It assumedthat deadlocks involving the startup process and backends were ableto be detected by the deadlock detector invoked within backends.But this assumption was incorrect. The startup process also shouldhave invoked the deadlock detector if necessary.To fix this bug, this commit makes the startup process invokethe deadlock detector if deadlock_timeout is reached while handlingthe recovery conflict on lock. Specifically, in that case, the startupprocess requests all the backends holding the conflicting locks tocheck themselves for deadlocks.Back-patch to v9.6. v9.5 has also this bug, but per discussion we decidednot to back-patch the fix to v9.5. Because v9.5 doesn't have someinfrastructure codes (e.g.,37c5486) that this bug fix patch depends on.We can apply those codes for the back-patch, but since the next minorversion release is the final one for v9.5, it's risky to do that. If weunexpectedly introduce new bug to v9.5 by the back-patch, there is nochance to fix that. We determined that the back-patch to v9.5 would givemore risk than gain.Author: Fujii MasaoReviewed-by: Bertrand Drouvot, Masahiko Sawada, Kyotaro HoriguchiDiscussion:https://postgr.es/m/4041d6b6-cf24-a120-36fa-1294220f8243@oss.nttdata.com1 parentb1ebec2 commit0f8977b
File tree
5 files changed
+141
-32
lines changed- src
- backend
- storage
- ipc
- lmgr
- tcop
- include/storage
5 files changed
+141
-32
lines changedLines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2651 | 2651 |
| |
2652 | 2652 |
| |
2653 | 2653 |
| |
| 2654 | + | |
| 2655 | + | |
| 2656 | + | |
| 2657 | + | |
| 2658 | + | |
| 2659 | + | |
| 2660 | + | |
2654 | 2661 |
| |
2655 | 2662 |
| |
2656 | 2663 |
| |
| |||
2669 | 2676 |
| |
2670 | 2677 |
| |
2671 | 2678 |
| |
2672 |
| - | |
| 2679 | + | |
2673 | 2680 |
| |
2674 | 2681 |
| |
2675 | 2682 |
| |
|
Lines changed: 114 additions & 29 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
45 | 49 |
| |
46 | 50 |
| |
47 | 51 |
| |
| |||
398 | 402 |
| |
399 | 403 |
| |
400 | 404 |
| |
401 |
| - | |
402 |
| - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
403 | 409 |
| |
404 | 410 |
| |
405 | 411 |
| |
| |||
410 | 416 |
| |
411 | 417 |
| |
412 | 418 |
| |
413 |
| - | |
| 419 | + | |
414 | 420 |
| |
415 | 421 |
| |
416 | 422 |
| |
| |||
432 | 438 |
| |
433 | 439 |
| |
434 | 440 |
| |
435 |
| - | |
| 441 | + | |
| 442 | + | |
436 | 443 |
| |
437 |
| - | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
438 | 455 |
| |
439 |
| - | |
440 |
| - | |
441 |
| - | |
442 |
| - | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
443 | 463 |
| |
444 | 464 |
| |
445 | 465 |
| |
446 | 466 |
| |
447 | 467 |
| |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
448 | 511 |
| |
449 | 512 |
| |
450 | 513 |
| |
451 | 514 |
| |
452 | 515 |
| |
453 | 516 |
| |
454 | 517 |
| |
| 518 | + | |
| 519 | + | |
455 | 520 |
| |
456 | 521 |
| |
457 | 522 |
| |
| |||
490 | 555 |
| |
491 | 556 |
| |
492 | 557 |
| |
493 |
| - | |
494 |
| - | |
495 |
| - | |
496 |
| - | |
497 |
| - | |
498 |
| - | |
499 |
| - | |
500 |
| - | |
501 |
| - | |
| 558 | + | |
502 | 559 |
| |
503 | 560 |
| |
504 | 561 |
| |
| |||
512 | 569 |
| |
513 | 570 |
| |
514 | 571 |
| |
| 572 | + | |
515 | 573 |
| |
516 |
| - | |
517 |
| - | |
518 |
| - | |
519 |
| - | |
520 |
| - | |
521 |
| - | |
522 |
| - | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
523 | 589 |
| |
524 | 590 |
| |
525 | 591 |
| |
526 | 592 |
| |
527 | 593 |
| |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
528 | 613 |
| |
529 | 614 |
| |
530 | 615 |
| |
531 | 616 |
| |
532 | 617 |
| |
533 | 618 |
| |
534 | 619 |
| |
| 620 | + | |
535 | 621 |
| |
536 | 622 |
| |
537 | 623 |
| |
| |||
591 | 677 |
| |
592 | 678 |
| |
593 | 679 |
| |
594 |
| - | |
595 |
| - | |
| 680 | + | |
596 | 681 |
| |
597 | 682 |
| |
598 | 683 |
| |
599 | 684 |
| |
600 |
| - | |
| 685 | + | |
601 | 686 |
| |
602 | 687 |
| |
603 | 688 |
| |
| |||
616 | 701 |
| |
617 | 702 |
| |
618 | 703 |
| |
619 |
| - | |
620 | 704 |
| |
621 | 705 |
| |
622 | 706 |
| |
623 | 707 |
| |
| 708 | + | |
624 | 709 |
| |
625 | 710 |
| |
626 | 711 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1784 | 1784 |
| |
1785 | 1785 |
| |
1786 | 1786 |
| |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
1787 | 1790 |
| |
1788 | 1791 |
| |
1789 | 1792 |
| |
|
Lines changed: 14 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2919 | 2919 |
| |
2920 | 2920 |
| |
2921 | 2921 |
| |
2922 |
| - | |
2923 |
| - | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
2924 | 2931 |
| |
2925 | 2932 |
| |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
2926 | 2937 |
| |
| 2938 | + | |
2927 | 2939 |
| |
2928 | 2940 |
| |
2929 | 2941 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
105 | 105 |
| |
106 | 106 |
| |
107 | 107 |
| |
| 108 | + | |
| 109 | + | |
108 | 110 |
| |
109 | 111 |
| |
110 | 112 |
| |
|
0 commit comments
Comments
(0)