- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit0da096d
committed
Fix recovery conflict SIGUSR1 handling.
We shouldn't be doing non-trivial work in signal handlers in general,and in this case the handler could reach unsafe code and corrupt state.It also clobbered its own "reason" code.Move all recovery conflict decision logic into the nextCHECK_FOR_INTERRUPTS(), and have the signal handler just set flags andthe latch, following the standard pattern. Since there are severaldifferent "reasons", use a separate flag for each.With this refactoring, the recovery conflict system no longerpiggy-backs on top of the regular query cancelation mechanism, butinstead raises an error directly if it decides that is necessary. Itstill needs to respect QueryCancelHoldoffCount, because otherwise theFEBE protocol might get out of sync (see commit2b3a8b2).This fixes one class of intermittent failure in the new031_recovery_conflict.pl test added by commit9f8a050, though the buggycoding is much older. Failures outside contrived testing seem to bevery rare (or perhaps incorrectly attributed) in the field, based onlack of reports.No back-patch for now due to complexity and release schedule. We havethe option to back-patch into 16 later, as 16 has prerequisite commitbea3d7e.Reviewed-by: Andres Freund <andres@anarazel.de> (earlier version)Reviewed-by: Michael Paquier <michael@paquier.xyz> (earlier version)Reviewed-by: Robert Haas <robertmhaas@gmail.com> (earlier version)Tested-by: Christoph Berg <myon@debian.org>Discussion:https://postgr.es/m/CA%2BhUKGK3PGKwcKqzoosamn36YW-fsuTdOPPF1i_rtEO%3DnEYKSg%40mail.gmail.comDiscussion:https://postgr.es/m/CALj2ACVr8au2J_9D88UfRCi0JdWhyQDDxAcSVav0B0irx9nXEg%40mail.gmail.com1 parent8c16ad3 commit0da096d
File tree
5 files changed
+186
-170
lines changed- src
- backend
- storage
- buffer
- ipc
- tcop
- include
- storage
- tcop
5 files changed
+186
-170
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4923 | 4923 |
| |
4924 | 4924 |
| |
4925 | 4925 |
| |
4926 |
| - | |
4927 |
| - | |
| 4926 | + | |
| 4927 | + | |
4928 | 4928 |
| |
4929 | 4929 |
| |
4930 | 4930 |
| |
|
Lines changed: 7 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
662 | 662 |
| |
663 | 663 |
| |
664 | 664 |
| |
665 |
| - | |
| 665 | + | |
666 | 666 |
| |
667 | 667 |
| |
668 |
| - | |
| 668 | + | |
669 | 669 |
| |
670 | 670 |
| |
671 |
| - | |
| 671 | + | |
672 | 672 |
| |
673 | 673 |
| |
674 |
| - | |
| 674 | + | |
675 | 675 |
| |
676 | 676 |
| |
677 |
| - | |
| 677 | + | |
678 | 678 |
| |
679 | 679 |
| |
680 |
| - | |
| 680 | + | |
681 | 681 |
| |
682 | 682 |
| |
683 |
| - | |
| 683 | + | |
684 | 684 |
| |
685 | 685 |
| |
686 | 686 |
| |
|
0 commit comments
Comments
(0)