- Notifications
You must be signed in to change notification settings - Fork5.2k
Commit31ed3cf
committed
Process session_preload_libraries within InitPostgres's transaction.
Previously we did this after InitPostgres, at a somewhat randomly chosenplace within PostgresMain. However, since commita0ffa88 doing thisoutside a transaction can cause a crash, if we need to check permissionswhile replacing a placeholder GUC. (Besides which, a preloaded librarycould itself want to do database access within _PG_init.)To avoid needing an additional transaction start/end in every session,move the process_session_preload_libraries call to within InitPostgres'stransaction. That requires teaching the code not to call it whenInitPostgres is called from somewhere other than PostgresMain, sincewe don't want session_preload_libraries to affect background workers.The most future-proof solution here seems to be to add an additionalflag parameter to InitPostgres; fortunately, we're not yet very worriedabout API stability for v15.Doing this also exposed the fact that we're currently honoringsession_preload_libraries in walsenders, even those not connected toany database. This seems, at minimum, a POLA violation: walsendersare not interactive sessions. Let's stop doing that.(All these comments also apply to local_preload_libraries, of course.)Per report from Gurjeet Singh (thanks also to Nathan Bossart and KyotaroHoriguchi for review). Backpatch to v15 wherea0ffa88 came in.Discussion:https://postgr.es/m/CABwTF4VEpwTHhRQ+q5MiC5ucngN-whN-PdcKeufX7eLSoAfbZA@mail.gmail.com1 parent19f8232 commit31ed3cf
File tree
6 files changed
+64
-25
lines changed- src
- backend
- bootstrap
- postmaster
- tcop
- utils/init
- include
6 files changed
+64
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
| 358 | + | |
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
| 478 | + | |
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
| |||
1694 | 1694 | | |
1695 | 1695 | | |
1696 | 1696 | | |
1697 | | - | |
| 1697 | + | |
1698 | 1698 | | |
1699 | 1699 | | |
1700 | 1700 | | |
1701 | 1701 | | |
1702 | | - | |
| 1702 | + | |
| 1703 | + | |
1703 | 1704 | | |
1704 | 1705 | | |
1705 | 1706 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5668 | 5668 | | |
5669 | 5669 | | |
5670 | 5670 | | |
5671 | | - | |
| 5671 | + | |
| 5672 | + | |
| 5673 | + | |
| 5674 | + | |
| 5675 | + | |
5672 | 5676 | | |
5673 | 5677 | | |
5674 | 5678 | | |
| |||
5691 | 5695 | | |
5692 | 5696 | | |
5693 | 5697 | | |
5694 | | - | |
| 5698 | + | |
| 5699 | + | |
| 5700 | + | |
| 5701 | + | |
| 5702 | + | |
5695 | 5703 | | |
5696 | 5704 | | |
5697 | 5705 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4152 | 4152 | | |
4153 | 4153 | | |
4154 | 4154 | | |
4155 | | - | |
| 4155 | + | |
| 4156 | + | |
| 4157 | + | |
| 4158 | + | |
| 4159 | + | |
4156 | 4160 | | |
4157 | 4161 | | |
4158 | 4162 | | |
| |||
4188 | 4192 | | |
4189 | 4193 | | |
4190 | 4194 | | |
4191 | | - | |
4192 | | - | |
4193 | | - | |
4194 | | - | |
4195 | | - | |
4196 | | - | |
4197 | 4195 | | |
4198 | 4196 | | |
4199 | 4197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
622 | 622 | | |
623 | 623 | | |
624 | 624 | | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
625 | 632 | | |
626 | | - | |
| 633 | + | |
| 634 | + | |
627 | 635 | | |
628 | 636 | | |
629 | 637 | | |
630 | | - | |
| 638 | + | |
631 | 639 | | |
632 | 640 | | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
637 | 653 | | |
638 | | - | |
639 | | - | |
| 654 | + | |
| 655 | + | |
640 | 656 | | |
641 | 657 | | |
642 | 658 | | |
643 | 659 | | |
644 | 660 | | |
645 | 661 | | |
646 | | - | |
647 | | - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
648 | 667 | | |
649 | 668 | | |
650 | 669 | | |
| |||
1108 | 1127 | | |
1109 | 1128 | | |
1110 | 1129 | | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
1111 | 1140 | | |
1112 | 1141 | | |
1113 | 1142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
460 | | - | |
461 | | - | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
462 | 465 | | |
463 | 466 | | |
464 | 467 | | |
| |||
0 commit comments
Comments
(0)