- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitd76652e
committed
Fix concurrent indexing operations with temporary tables
Attempting to use CREATE INDEX, DROP INDEX or REINDEX with CONCURRENTLYon a temporary relation with ON COMMIT actions triggered unexpectederrors because those operations use multiple transactions internally tocomplete their work. Here is for example one confusing error when usingON COMMIT DELETE ROWS:ERROR: index "foo" already contains dataIssues related to temporary relations and concurrent indexing are fixedin this commit by enforcing the non-concurrent path to be taken fortemporary relations even if using CONCURRENTLY, transparently to theuser. Using a non-concurrent path does not matter in practice as lockscannot be taken on a temporary relation by a session different than theone owning the relation, and the non-concurrent operation is moreeffective.The problem exists with REINDEX since v12 with the introduction ofCONCURRENTLY, and with CREATE/DROP INDEX since CONCURRENTLY exists forthose commands. In all supported versions, this caused only confusingerror messages to be generated. Note that with REINDEX, it was alsopossible to issue a REINDEX CONCURRENTLY for a temporary relation ownedby a different session, leading to a server crash.The idea to enforce transparently the non-concurrent code path fortemporary relations comes originally from Andres Freund.Reported-by: Manuel RiggerAuthor: Michael Paquier, Heikki LinnakangasReviewed-by: Andres Freund, Álvaro Herrera, Heikki LinnakangasDiscussion:https://postgr.es/m/CA+u7OA6gP7YAeCguyseusYcc=uR8+ypjCcgDDCTzjQ+k6S9ksQ@mail.gmail.comBackpatch-through: 9.41 parentba1dfbe commitd76652e
File tree
9 files changed
+129
-8
lines changed- doc/src/sgml/ref
- src
- backend
- catalog
- commands
- utils/cache
- include/utils
- test/regress
- expected
- sql
9 files changed
+129
-8
lines changedLines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
123 | 123 |
| |
124 | 124 |
| |
125 | 125 |
| |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
126 | 131 |
| |
127 | 132 |
| |
128 | 133 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
58 | 58 |
| |
59 | 59 |
| |
60 | 60 |
| |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
61 | 66 |
| |
62 | 67 |
| |
63 | 68 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1336 | 1336 |
| |
1337 | 1337 |
| |
1338 | 1338 |
| |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
1339 | 1348 |
| |
1340 | 1349 |
| |
1341 | 1350 |
| |
|
Lines changed: 20 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
302 | 302 |
| |
303 | 303 |
| |
304 | 304 |
| |
| 305 | + | |
305 | 306 |
| |
306 | 307 |
| |
307 | 308 |
| |
| |||
330 | 331 |
| |
331 | 332 |
| |
332 | 333 |
| |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
333 | 346 |
| |
334 | 347 |
| |
335 | 348 |
| |
| |||
355 | 368 |
| |
356 | 369 |
| |
357 | 370 |
| |
358 |
| - | |
| 371 | + | |
359 | 372 |
| |
360 | 373 |
| |
361 | 374 |
| |
| |||
540 | 553 |
| |
541 | 554 |
| |
542 | 555 |
| |
543 |
| - | |
544 |
| - | |
| 556 | + | |
| 557 | + | |
545 | 558 |
| |
546 | 559 |
| |
547 | 560 |
| |
| |||
592 | 605 |
| |
593 | 606 |
| |
594 | 607 |
| |
595 |
| - | |
| 608 | + | |
596 | 609 |
| |
597 | 610 |
| |
598 | 611 |
| |
| |||
606 | 619 |
| |
607 | 620 |
| |
608 | 621 |
| |
609 |
| - | |
610 |
| - | |
| 622 | + | |
| 623 | + | |
611 | 624 |
| |
612 | 625 |
| |
613 | 626 |
| |
614 | 627 |
| |
615 | 628 |
| |
616 | 629 |
| |
617 |
| - | |
| 630 | + | |
618 | 631 |
| |
619 | 632 |
| |
620 | 633 |
| |
|
Lines changed: 17 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
784 | 784 |
| |
785 | 785 |
| |
786 | 786 |
| |
787 |
| - | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
788 | 792 |
| |
789 | 793 |
| |
790 | 794 |
| |
| |||
875 | 879 |
| |
876 | 880 |
| |
877 | 881 |
| |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
878 | 894 |
| |
879 | 895 |
| |
880 | 896 |
| |
|
Lines changed: 22 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1797 | 1797 |
| |
1798 | 1798 |
| |
1799 | 1799 |
| |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
1800 | 1822 |
| |
1801 | 1823 |
| |
1802 | 1824 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
103 | 103 |
| |
104 | 104 |
| |
105 | 105 |
| |
| 106 | + | |
106 | 107 |
| |
107 | 108 |
| |
108 | 109 |
| |
|
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2387 | 2387 |
| |
2388 | 2388 |
| |
2389 | 2389 |
| |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
2390 | 2415 |
| |
2391 | 2416 |
| |
2392 | 2417 |
| |
|
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
756 | 756 |
| |
757 | 757 |
| |
758 | 758 |
| |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
759 | 784 |
| |
760 | 785 |
| |
761 | 786 |
| |
|
0 commit comments
Comments
(0)