forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit56259c3
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 parent6ab98db commit56259c3
3 files changed
+82
-73
lines changedLines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
| 33 | + | |
33 | 34 |
| |
34 | 35 |
| |
35 | 36 |
| |
| |||
2576 | 2577 |
| |
2577 | 2578 |
| |
2578 | 2579 |
| |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
2579 | 2583 |
| |
2580 | 2584 |
| |
2581 | 2585 |
| |
| |||
4785 | 4789 |
| |
4786 | 4790 |
| |
4787 | 4791 |
| |
| 4792 | + | |
| 4793 | + | |
| 4794 | + | |
4788 | 4795 |
| |
4789 | 4796 |
| |
4790 | 4797 |
| |
|
Lines changed: 72 additions & 72 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
144 | 144 |
| |
145 | 145 |
| |
146 | 146 |
| |
147 |
| - | |
148 | 147 |
| |
149 | 148 |
| |
150 | 149 |
| |
| |||
3799 | 3798 |
| |
3800 | 3799 |
| |
3801 | 3800 |
| |
3802 |
| - | |
3803 |
| - | |
3804 |
| - | |
3805 |
| - | |
3806 |
| - | |
| 3801 | + | |
| 3802 | + | |
3807 | 3803 |
| |
3808 |
| - | |
3809 |
| - | |
3810 |
| - | |
| 3804 | + | |
| 3805 | + | |
| 3806 | + | |
3811 | 3807 |
| |
3812 |
| - | |
3813 |
| - | |
3814 |
| - | |
3815 |
| - | |
3816 |
| - | |
3817 |
| - | |
3818 |
| - | |
3819 |
| - | |
3820 |
| - | |
3821 |
| - | |
3822 |
| - | |
| 3808 | + | |
| 3809 | + | |
| 3810 | + | |
| 3811 | + | |
| 3812 | + | |
3823 | 3813 |
| |
3824 | 3814 |
| |
3825 | 3815 |
| |
| |||
3954 | 3944 |
| |
3955 | 3945 |
| |
3956 | 3946 |
| |
| 3947 | + | |
3957 | 3948 |
| |
| 3949 | + | |
3958 | 3950 |
| |
3959 | 3951 |
| |
3960 | 3952 |
| |
| |||
3988 | 3980 |
| |
3989 | 3981 |
| |
3990 | 3982 |
| |
3991 |
| - | |
| 3983 | + | |
3992 | 3984 |
| |
3993 |
| - | |
3994 |
| - | |
3995 |
| - | |
3996 |
| - | |
3997 |
| - | |
3998 |
| - | |
3999 |
| - | |
4000 |
| - | |
4001 |
| - | |
4002 |
| - | |
4003 |
| - | |
4004 |
| - | |
4005 |
| - | |
4006 |
| - | |
| 3985 | + | |
| 3986 | + | |
4007 | 3987 |
| |
4008 | 3988 |
| |
4009 |
| - | |
4010 |
| - | |
| 3989 | + | |
| 3990 | + | |
4011 | 3991 |
| |
4012 |
| - | |
4013 |
| - | |
4014 |
| - | |
4015 |
| - | |
4016 |
| - | |
4017 |
| - | |
| 3992 | + | |
| 3993 | + | |
4018 | 3994 |
| |
4019 |
| - | |
4020 |
| - | |
4021 |
| - | |
4022 |
| - | |
| 3995 | + | |
| 3996 | + | |
| 3997 | + | |
| 3998 | + | |
| 3999 | + | |
| 4000 | + | |
| 4001 | + | |
| 4002 | + | |
| 4003 | + | |
| 4004 | + | |
4023 | 4005 |
| |
4024 |
| - | |
4025 |
| - | |
| 4006 | + | |
| 4007 | + | |
| 4008 | + | |
| 4009 | + | |
4026 | 4010 |
| |
4027 |
| - | |
| 4011 | + | |
| 4012 | + | |
4028 | 4013 |
| |
4029 |
| - | |
4030 |
| - | |
4031 |
| - | |
4032 |
| - | |
4033 |
| - | |
4034 |
| - | |
4035 |
| - | |
4036 |
| - | |
4037 |
| - | |
| 4014 | + | |
| 4015 | + | |
| 4016 | + | |
| 4017 | + | |
4038 | 4018 |
| |
4039 |
| - | |
4040 |
| - | |
4041 | 4019 |
| |
4042 | 4020 |
| |
4043 | 4021 |
| |
| |||
4071 | 4049 |
| |
4072 | 4050 |
| |
4073 | 4051 |
| |
| 4052 | + | |
4074 | 4053 |
| |
4075 | 4054 |
| |
4076 | 4055 |
| |
| |||
4107 | 4086 |
| |
4108 | 4087 |
| |
4109 | 4088 |
| |
4110 |
| - | |
4111 |
| - | |
4112 | 4089 |
| |
4113 | 4090 |
| |
4114 | 4091 |
| |
| |||
4121 | 4098 |
| |
4122 | 4099 |
| |
4123 | 4100 |
| |
| 4101 | + | |
| 4102 | + | |
4124 | 4103 |
| |
4125 | 4104 |
| |
4126 | 4105 |
| |
| |||
4130 | 4109 |
| |
4131 | 4110 |
| |
4132 | 4111 |
| |
4133 |
| - | |
4134 | 4112 |
| |
4135 | 4113 |
| |
| 4114 | + | |
4136 | 4115 |
| |
4137 | 4116 |
| |
4138 | 4117 |
| |
4139 | 4118 |
| |
4140 | 4119 |
| |
4141 | 4120 |
| |
4142 |
| - | |
4143 |
| - | |
| 4121 | + | |
4144 | 4122 |
| |
4145 | 4123 |
| |
4146 | 4124 |
| |
| |||
4151 | 4129 |
| |
4152 | 4130 |
| |
4153 | 4131 |
| |
| 4132 | + | |
4154 | 4133 |
| |
4155 | 4134 |
| |
4156 | 4135 |
| |
| |||
4167 | 4146 |
| |
4168 | 4147 |
| |
4169 | 4148 |
| |
4170 |
| - | |
4171 |
| - | |
| 4149 | + | |
| 4150 | + | |
4172 | 4151 |
| |
4173 |
| - | |
4174 |
| - | |
| 4152 | + | |
| 4153 | + | |
4175 | 4154 |
| |
4176 |
| - | |
4177 |
| - | |
| 4155 | + | |
| 4156 | + | |
| 4157 | + | |
| 4158 | + | |
| 4159 | + | |
| 4160 | + | |
| 4161 | + | |
| 4162 | + | |
| 4163 | + | |
| 4164 | + | |
| 4165 | + | |
| 4166 | + | |
| 4167 | + | |
| 4168 | + | |
| 4169 | + | |
| 4170 | + | |
| 4171 | + | |
| 4172 | + | |
| 4173 | + | |
| 4174 | + | |
4178 | 4175 |
| |
4179 | 4176 |
| |
4180 | 4177 |
| |
| |||
4227 | 4224 |
| |
4228 | 4225 |
| |
4229 | 4226 |
| |
| 4227 | + | |
| 4228 | + | |
| 4229 | + | |
4230 | 4230 |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
135 | 135 |
| |
136 | 136 |
| |
137 | 137 |
| |
| 138 | + | |
| 139 | + | |
138 | 140 |
| |
139 | 141 |
| |
140 | 142 |
| |
| |||
149 | 151 |
| |
150 | 152 |
| |
151 | 153 |
| |
152 |
| - | |
153 | 154 |
| |
| 155 | + | |
154 | 156 |
| |
155 | 157 |
| |
156 | 158 |
| |
|
0 commit comments
Comments
(0)