forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc899c68
committed
Fix creation of partition descriptor during concurrent detach+drop
If a partition undergoes DETACH CONCURRENTLY immediately followed byDROP, this could cause a problem for a concurrent transactionrecomputing the partition descriptor when running a prepared statement,because it tries to dereference a pointer to a tuple that's not found ina catalog scan.The existing retry logic added in commitdbca346 is sufficient tocope with the overall problem, provided we don't try to dereference anon-existant heap tuple.Arguably, the code in RelationBuildPartitionDesc() has been wrong allalong, since no check was added in commit898e5e3 against receivinga NULL tuple from the catalog scan; that bug has only becomeuser-visible with DETACH CONCURRENTLY which was added in branch 14.Therefore, even though there's no known mechanism to cause a crashbecause of this, backpatch the addition of such a check to all supportedbranches. In branches prior to 14, this would cause the code to failwith a "missing relpartbound for relation XYZ" error instead ofcrashing; that's okay, because there are no reports of such behavioranyway.Author: Kuntal Ghosh <kuntalghosh.2007@gmail.com>Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>Reviewed-by: Tender Wang <tndrwang@gmail.com>Discussion:https://postgr.es/m/18559-b48286d2eacd9a4e@postgresql.org1 parenta459ac5 commitc899c68
1 file changed
+22
-8
lines changedLines changed: 22 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
209 | 209 |
| |
210 | 210 |
| |
211 | 211 |
| |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
212 | 216 |
| |
213 | 217 |
| |
214 | 218 |
| |
| |||
223 | 227 |
| |
224 | 228 |
| |
225 | 229 |
| |
226 |
| - | |
227 |
| - | |
228 | 230 |
| |
229 | 231 |
| |
230 | 232 |
| |
| |||
233 | 235 |
| |
234 | 236 |
| |
235 | 237 |
| |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
236 | 243 |
| |
237 |
| - | |
238 |
| - | |
239 |
| - | |
240 |
| - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
241 | 254 |
| |
242 | 255 |
| |
243 | 256 |
| |
244 | 257 |
| |
245 |
| - | |
246 |
| - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
247 | 261 |
| |
248 | 262 |
| |
249 | 263 |
| |
|
0 commit comments
Comments
(0)