forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7b5d4c2
committed
Fix Portal snapshot tracking to handle subtransactions properly.
Commit84f5c29 forgot to consider the possibility thatEnsurePortalSnapshotExists could run inside a subtransaction withlifespan shorter than the Portal's. In that case, the new activesnapshot would be popped at the end of the subtransaction, leavinga dangling pointer in the Portal, with mayhem ensuing.To fix, make sure the ActiveSnapshot stack entry is marked withthe same subtransaction nesting level as the associated Portal.It's certainly safe to do so since we won't be here at all unlessthe stack is empty; hence we can't create an out-of-order stack.Let's also apply this logic in the case where PortalRunUtilitysets portalSnapshot, just to be sure that path can't cause similarproblems. It's slightly less clear that that path can't createan out-of-order stack, so add an assertion guarding it.Report and patch by Bertrand Drouvot (with kibitzing by me).Back-patch to v11, like the previous commit.Discussion:https://postgr.es/m/ff82b8c5-77f4-3fe7-6028-fcf3303e82dd@amazon.com1 parent2d44dee commit7b5d4c2
File tree
8 files changed
+93
-8
lines changed- src
- backend
- access/transam
- tcop
- utils
- mmgr
- time
- include/utils
- pl/plpgsql/src
- expected
- sql
8 files changed
+93
-8
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4863 | 4863 |
| |
4864 | 4864 |
| |
4865 | 4865 |
| |
| 4866 | + | |
4866 | 4867 |
| |
4867 | 4868 |
| |
4868 | 4869 |
| |
|
Lines changed: 20 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
480 | 480 |
| |
481 | 481 |
| |
482 | 482 |
| |
483 |
| - | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
484 | 486 |
| |
485 | 487 |
| |
486 | 488 |
| |
| |||
1136 | 1138 |
| |
1137 | 1139 |
| |
1138 | 1140 |
| |
1139 |
| - | |
1140 |
| - | |
1141 |
| - | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
1142 | 1150 |
| |
1143 | 1151 |
| |
1144 | 1152 |
| |
| |||
1784 | 1792 |
| |
1785 | 1793 |
| |
1786 | 1794 |
| |
1787 |
| - | |
1788 |
| - | |
1789 |
| - | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
1790 | 1803 |
| |
1791 | 1804 |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
210 | 210 |
| |
211 | 211 |
| |
212 | 212 |
| |
| 213 | + | |
213 | 214 |
| |
214 | 215 |
| |
215 | 216 |
| |
| |||
657 | 658 |
| |
658 | 659 |
| |
659 | 660 |
| |
| 661 | + | |
660 | 662 |
| |
661 | 663 |
| |
662 | 664 |
| |
| |||
940 | 942 |
| |
941 | 943 |
| |
942 | 944 |
| |
| 945 | + | |
943 | 946 |
| |
944 | 947 |
| |
945 | 948 |
| |
| |||
954 | 957 |
| |
955 | 958 |
| |
956 | 959 |
| |
| 960 | + | |
957 | 961 |
| |
958 | 962 |
| |
959 | 963 |
| |
|
Lines changed: 16 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
678 | 678 |
| |
679 | 679 |
| |
680 | 680 |
| |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
681 | 695 |
| |
682 | 696 |
| |
683 | 697 |
| |
684 | 698 |
| |
| 699 | + | |
685 | 700 |
| |
686 | 701 |
| |
687 | 702 |
| |
| |||
695 | 710 |
| |
696 | 711 |
| |
697 | 712 |
| |
698 |
| - | |
| 713 | + | |
699 | 714 |
| |
700 | 715 |
| |
701 | 716 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
130 | 130 |
| |
131 | 131 |
| |
132 | 132 |
| |
| 133 | + | |
133 | 134 |
| |
134 | 135 |
| |
135 | 136 |
| |
| |||
219 | 220 |
| |
220 | 221 |
| |
221 | 222 |
| |
| 223 | + | |
222 | 224 |
| |
223 | 225 |
| |
224 | 226 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
114 | 114 |
| |
115 | 115 |
| |
116 | 116 |
| |
| 117 | + | |
117 | 118 |
| |
118 | 119 |
| |
119 | 120 |
| |
|
Lines changed: 28 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
430 | 430 |
| |
431 | 431 |
| |
432 | 432 |
| |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
433 | 461 |
| |
434 | 462 |
| |
435 | 463 |
| |
|
Lines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
354 | 354 |
| |
355 | 355 |
| |
356 | 356 |
| |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
357 | 378 |
| |
358 | 379 |
| |
359 | 380 |
| |
|
0 commit comments
Comments
(0)