forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite3ebcca
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 parent3187ef7 commite3ebcca
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 | |
---|---|---|---|
| |||
940 | 940 |
| |
941 | 941 |
| |
942 | 942 |
| |
943 |
| - | |
944 |
| - | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
945 | 946 |
| |
946 | 947 |
| |
947 | 948 |
| |
948 |
| - | |
| 949 | + | |
| 950 | + | |
949 | 951 |
| |
950 | 952 |
| |
951 | 953 |
| |
| |||
1069 | 1071 |
| |
1070 | 1072 |
| |
1071 | 1073 |
| |
1072 |
| - | |
1073 |
| - | |
1074 |
| - | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
1075 | 1080 |
| |
1076 | 1081 |
| |
1077 | 1082 |
| |
| |||
1102 | 1107 |
| |
1103 | 1108 |
| |
1104 | 1109 |
| |
1105 |
| - | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
1106 | 1125 |
| |
1107 | 1126 |
| |
1108 | 1127 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
9035 | 9035 |
| |
9036 | 9036 |
| |
9037 | 9037 |
| |
| 9038 | + | |
| 9039 | + | |
| 9040 | + | |
| 9041 | + | |
| 9042 | + | |
| 9043 | + | |
| 9044 | + | |
| 9045 | + | |
| 9046 | + | |
| 9047 | + | |
| 9048 | + | |
| 9049 | + | |
| 9050 | + | |
| 9051 | + | |
| 9052 | + | |
| 9053 | + | |
| 9054 | + | |
| 9055 | + |
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2697 | 2697 |
| |
2698 | 2698 |
| |
2699 | 2699 |
| |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + |
0 commit comments
Comments
(0)