forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0cecc90
committed
Lock before setting relhassubclass on RELKIND_PARTITIONED_INDEX.
Commit5b56264 added a comment thatSetRelationHasSubclass() callers must hold this lock. When commit17f206f extended use of this column topartitioned indexes, it didn't take the lock. As the latter commitmessage mentioned, we currently never reset a partitioned index torelhassubclass=f. That largely avoids harm from the lock omission. Thecause for fixing this now is to unblock introducing a rule about locksrequired to heap_update() a pg_class row. This might cause moredeadlocks. It gives minor user-visible benefits:- If an ALTER INDEX SET TABLESPACE runs concurrently with ALTER TABLE ATTACH PARTITION or CREATE PARTITION OF, one transaction blocks instead of failing with "tuple concurrently updated". (Many cases of DDL concurrency still fail that way.)- Match ALTER INDEX ATTACH PARTITION in choosing to lock the index.While not user-visible today, we'll need this if we ever make somethingset the flag to false for a partitioned index, like ANALYZE does todayfor tables. Back-patch to v12 (all supported versions), the plan forthe commit relying on the new rule. In back branches, addLockOrStrongerHeldByMe() instead of adding a LockHeldByMe() parameter.Reviewed (in an earlier version) by Robert Haas.Discussion:https://postgr.es/m/20240611024525.9f.nmisch@google.com1 parentf88cdb3 commit0cecc90
File tree
7 files changed
+61
-30
lines changed- src
- backend
- catalog
- commands
- storage/lmgr
- include/storage
7 files changed
+61
-30
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1058 | 1058 |
| |
1059 | 1059 |
| |
1060 | 1060 |
| |
| 1061 | + | |
1061 | 1062 |
| |
1062 | 1063 |
| |
1063 | 1064 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4355 | 4355 |
| |
4356 | 4356 |
| |
4357 | 4357 |
| |
| 4358 | + | |
| 4359 | + | |
4358 | 4360 |
| |
| 4361 | + | |
4359 | 4362 |
| |
4360 | 4363 |
| |
4361 | 4364 |
| |
|
Lines changed: 14 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3483 | 3483 |
| |
3484 | 3484 |
| |
3485 | 3485 |
| |
3486 |
| - | |
3487 |
| - | |
| 3486 | + | |
| 3487 | + | |
| 3488 | + | |
| 3489 | + | |
| 3490 | + | |
| 3491 | + | |
| 3492 | + | |
| 3493 | + | |
| 3494 | + | |
3488 | 3495 |
| |
3489 | 3496 |
| |
3490 | 3497 |
| |
| |||
3499 | 3506 |
| |
3500 | 3507 |
| |
3501 | 3508 |
| |
| 3509 | + | |
| 3510 | + | |
| 3511 | + | |
| 3512 | + | |
| 3513 | + | |
3502 | 3514 |
| |
3503 | 3515 |
| |
3504 | 3516 |
| |
|
Lines changed: 13 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
335 | 335 |
| |
336 | 336 |
| |
337 | 337 |
| |
338 |
| - | |
339 |
| - | |
| 338 | + | |
| 339 | + | |
340 | 340 |
| |
341 |
| - | |
342 |
| - | |
343 |
| - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
344 | 350 |
| |
345 |
| - | |
346 |
| - | |
347 |
| - | |
348 |
| - | |
349 |
| - | |
350 |
| - | |
351 |
| - | |
352 |
| - | |
353 |
| - | |
354 |
| - | |
355 |
| - | |
356 |
| - | |
357 |
| - | |
358 |
| - | |
359 |
| - | |
360 |
| - | |
361 |
| - | |
| 351 | + | |
362 | 352 |
| |
363 |
| - | |
| 353 | + | |
364 | 354 |
| |
365 | 355 |
| |
366 | 356 |
| |
|
Lines changed: 26 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
578 | 578 |
| |
579 | 579 |
| |
580 | 580 |
| |
581 |
| - | |
582 |
| - | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
583 | 588 |
| |
584 | 589 |
| |
585 |
| - | |
| 590 | + | |
| 591 | + | |
586 | 592 |
| |
587 | 593 |
| |
588 | 594 |
| |
| |||
598 | 604 |
| |
599 | 605 |
| |
600 | 606 |
| |
601 |
| - | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
602 | 624 |
| |
603 | 625 |
| |
604 | 626 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
| 51 | + | |
| 52 | + | |
51 | 53 |
| |
52 | 54 |
| |
53 | 55 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
567 | 567 |
| |
568 | 568 |
| |
569 | 569 |
| |
570 |
| - | |
| 570 | + | |
| 571 | + | |
571 | 572 |
| |
572 | 573 |
| |
573 | 574 |
| |
|
0 commit comments
Comments
(0)