forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite6c17c8
committed
Fix possible crash during FATAL exit from reindexing.
index.c supposed that it could just use a PG_TRY block to clean up thestate associated with an active REINDEX operation. However, that codedoesn't run if we do a FATAL exit --- for example, due to a SIGTERMshutdown signal --- while the REINDEX is happening. And that state doesget consulted during catalog accesses, which makes it problematic if wedo any catalog accesses during shutdown --- for example, to clean up anytemp tables created in the session.If this combination of circumstances occurred, we could find ourselvestrying to access already-freed memory. In debug builds that'd fairlyreliably cause an assertion failure. In production we might oftenget away with it, but with some bad luck it could cause a core dump.Another possible bad outcome is an erroneous conclusion that anindex-to-be-accessed is being reindexed; but it looks like that wouldbe unlikely to have any consequences worse than failing to drop temptables right away. (They'd still get dropped by the next session thatuses that temp schema.)To fix, get rid of the use of PG_TRY here, and instead hook intothe transaction abort mechanisms to clean up reindex state.Per bug #16378 from Alexander Lakhin. This has been wrong for avery long time, so back-patch to all supported branches.Discussion:https://postgr.es/m/16378-7a70ca41b3ec2009@postgresql.org1 parent0d0a0e4 commite6c17c8
3 files changed
+80
-71
lines changedLines changed: 7 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 |
| |
| |||
2577 | 2578 |
| |
2578 | 2579 |
| |
2579 | 2580 |
| |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
2580 | 2584 |
| |
2581 | 2585 |
| |
2582 | 2586 |
| |
| |||
4684 | 4688 |
| |
4685 | 4689 |
| |
4686 | 4690 |
| |
| 4691 | + | |
| 4692 | + | |
| 4693 | + | |
4687 | 4694 |
| |
4688 | 4695 |
| |
4689 | 4696 |
| |
|
Lines changed: 69 additions & 70 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
126 | 126 |
| |
127 | 127 |
| |
128 | 128 |
| |
129 |
| - | |
130 | 129 |
| |
131 | 130 |
| |
132 | 131 |
| |
| |||
3457 | 3456 |
| |
3458 | 3457 |
| |
3459 | 3458 |
| |
3460 |
| - | |
3461 |
| - | |
3462 |
| - | |
3463 |
| - | |
3464 |
| - | |
| 3459 | + | |
| 3460 | + | |
3465 | 3461 |
| |
3466 |
| - | |
3467 |
| - | |
3468 |
| - | |
| 3462 | + | |
| 3463 | + | |
| 3464 | + | |
3469 | 3465 |
| |
3470 |
| - | |
3471 |
| - | |
3472 |
| - | |
3473 |
| - | |
3474 |
| - | |
3475 |
| - | |
3476 |
| - | |
3477 |
| - | |
3478 |
| - | |
3479 |
| - | |
3480 |
| - | |
| 3466 | + | |
| 3467 | + | |
| 3468 | + | |
| 3469 | + | |
| 3470 | + | |
3481 | 3471 |
| |
3482 | 3472 |
| |
3483 | 3473 |
| |
| |||
3612 | 3602 |
| |
3613 | 3603 |
| |
3614 | 3604 |
| |
| 3605 | + | |
3615 | 3606 |
| |
| 3607 | + | |
3616 | 3608 |
| |
3617 | 3609 |
| |
3618 | 3610 |
| |
| |||
3630 | 3622 |
| |
3631 | 3623 |
| |
3632 | 3624 |
| |
3633 |
| - | |
| 3625 | + | |
3634 | 3626 |
| |
3635 |
| - | |
3636 |
| - | |
3637 |
| - | |
3638 |
| - | |
3639 |
| - | |
3640 |
| - | |
3641 |
| - | |
3642 |
| - | |
3643 |
| - | |
3644 |
| - | |
3645 |
| - | |
3646 |
| - | |
3647 |
| - | |
3648 |
| - | |
| 3627 | + | |
| 3628 | + | |
3649 | 3629 |
| |
3650 | 3630 |
| |
3651 |
| - | |
3652 |
| - | |
| 3631 | + | |
| 3632 | + | |
3653 | 3633 |
| |
3654 |
| - | |
3655 |
| - | |
3656 |
| - | |
3657 |
| - | |
3658 |
| - | |
3659 |
| - | |
| 3634 | + | |
| 3635 | + | |
3660 | 3636 |
| |
3661 |
| - | |
3662 |
| - | |
3663 |
| - | |
3664 |
| - | |
| 3637 | + | |
| 3638 | + | |
| 3639 | + | |
| 3640 | + | |
| 3641 | + | |
| 3642 | + | |
| 3643 | + | |
| 3644 | + | |
| 3645 | + | |
| 3646 | + | |
3665 | 3647 |
| |
3666 |
| - | |
3667 |
| - | |
| 3648 | + | |
| 3649 | + | |
| 3650 | + | |
| 3651 | + | |
3668 | 3652 |
| |
3669 |
| - | |
| 3653 | + | |
| 3654 | + | |
3670 | 3655 |
| |
3671 |
| - | |
3672 |
| - | |
3673 |
| - | |
3674 |
| - | |
3675 |
| - | |
3676 |
| - | |
3677 |
| - | |
3678 |
| - | |
3679 |
| - | |
| 3656 | + | |
| 3657 | + | |
| 3658 | + | |
| 3659 | + | |
3680 | 3660 |
| |
3681 |
| - | |
3682 |
| - | |
3683 | 3661 |
| |
3684 | 3662 |
| |
3685 | 3663 |
| |
| |||
3712 | 3690 |
| |
3713 | 3691 |
| |
3714 | 3692 |
| |
| 3693 | + | |
3715 | 3694 |
| |
3716 | 3695 |
| |
3717 | 3696 |
| |
| |||
3748 | 3727 |
| |
3749 | 3728 |
| |
3750 | 3729 |
| |
3751 |
| - | |
3752 |
| - | |
3753 | 3730 |
| |
3754 | 3731 |
| |
3755 | 3732 |
| |
| |||
3762 | 3739 |
| |
3763 | 3740 |
| |
3764 | 3741 |
| |
| 3742 | + | |
| 3743 | + | |
3765 | 3744 |
| |
3766 | 3745 |
| |
3767 | 3746 |
| |
| |||
3773 | 3752 |
| |
3774 | 3753 |
| |
3775 | 3754 |
| |
| 3755 | + | |
3776 | 3756 |
| |
3777 | 3757 |
| |
3778 | 3758 |
| |
3779 | 3759 |
| |
3780 | 3760 |
| |
3781 | 3761 |
| |
3782 |
| - | |
3783 |
| - | |
| 3762 | + | |
3784 | 3763 |
| |
3785 | 3764 |
| |
3786 | 3765 |
| |
| |||
3789 | 3768 |
| |
3790 | 3769 |
| |
3791 | 3770 |
| |
| 3771 | + | |
3792 | 3772 |
| |
3793 | 3773 |
| |
3794 | 3774 |
| |
| |||
3803 | 3783 |
| |
3804 | 3784 |
| |
3805 | 3785 |
| |
3806 |
| - | |
3807 |
| - | |
| 3786 | + | |
| 3787 | + | |
3808 | 3788 |
| |
3809 |
| - | |
3810 |
| - | |
| 3789 | + | |
| 3790 | + | |
3811 | 3791 |
| |
3812 |
| - | |
| 3792 | + | |
| 3793 | + | |
| 3794 | + | |
| 3795 | + | |
| 3796 | + | |
| 3797 | + | |
| 3798 | + | |
| 3799 | + | |
| 3800 | + | |
| 3801 | + | |
| 3802 | + | |
| 3803 | + | |
| 3804 | + | |
| 3805 | + | |
| 3806 | + | |
| 3807 | + | |
| 3808 | + | |
| 3809 | + | |
| 3810 | + | |
| 3811 | + | |
3813 | 3812 |
|
Lines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
118 | 118 |
| |
119 | 119 |
| |
120 | 120 |
| |
| 121 | + | |
| 122 | + | |
121 | 123 |
| |
122 | 124 |
| |
123 | 125 |
| |
| |||
132 | 134 |
| |
133 | 135 |
| |
134 | 136 |
| |
135 |
| - | |
| 137 | + | |
| 138 | + | |
136 | 139 |
| |
137 | 140 |
|
0 commit comments
Comments
(0)