- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitb5c73ee
committed
postgres_fdw: Fix connection leak.
In postgres_fdw, the cached connections to foreign servers will not beclosed until the local session exits if the user mappings or foreign serversthat those connections depend on are dropped. Those connections can beleaked.To fix that connection leak issue, after a change to a pg_foreign_serveror pg_user_mapping catalog entry, this commit makes postgres_fdw closethe connections depending on that entry immediately if currenttransaction has not used those connections yet. Otherwise, mark thoseconnections as invalid and then close them at the end of current transaction,since they cannot be closed in the midst of the transaction using them.Closed connections will be remade at the next opportunity if necessary.Back-patch to all supported branches.Author: Bharath RupireddyReviewed-by: Zhihong Yu, Zhijie Hou, Fujii MasaoDiscussion:https://postgr.es/m/CALj2ACVNcGH_6qLY-4_tXz8JLvA+4yeBThRfxMz7Oxbk1aHcpQ@mail.gmail.com1 parent14649bf commitb5c73ee
File tree
3 files changed
+58
-7
lines changed- contrib/postgres_fdw
- expected
- sql
3 files changed
+58
-7
lines changedLines changed: 26 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
833 | 833 |
| |
834 | 834 |
| |
835 | 835 |
| |
836 |
| - | |
837 |
| - | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
838 | 839 |
| |
839 | 840 |
| |
840 | 841 |
| |
841 |
| - | |
| 842 | + | |
| 843 | + | |
842 | 844 |
| |
843 | 845 |
| |
844 | 846 |
| |
| |||
962 | 964 |
| |
963 | 965 |
| |
964 | 966 |
| |
965 |
| - | |
966 |
| - | |
967 |
| - | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
968 | 973 |
| |
969 | 974 |
| |
970 | 975 |
| |
| |||
995 | 1000 |
| |
996 | 1001 |
| |
997 | 1002 |
| |
998 |
| - | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
999 | 1018 |
| |
1000 | 1019 |
| |
1001 | 1020 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3968 | 3968 |
| |
3969 | 3969 |
| |
3970 | 3970 |
| |
| 3971 | + | |
| 3972 | + | |
| 3973 | + | |
| 3974 | + | |
| 3975 | + | |
| 3976 | + | |
| 3977 | + | |
| 3978 | + | |
| 3979 | + | |
| 3980 | + | |
| 3981 | + | |
| 3982 | + | |
| 3983 | + | |
| 3984 | + | |
| 3985 | + | |
| 3986 | + | |
| 3987 | + | |
| 3988 | + |
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
935 | 935 |
| |
936 | 936 |
| |
937 | 937 |
| |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + |
0 commit comments
Comments
(0)