forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2b8e527
committed
Fix handling of shared statistics with dropped databases
Dropping a database while a connection is attempted on it was able tolead to the presence of valid database entries in shared statistics.The issue is that MyDatabaseId was getting set too early than it should,as, if the connection attempted on the dropped database fails whenrenamed or dropped, the shutdown callback of the shared statistics wouldfinish by re-inserting a correct entry related to the database alreadydropped.As analyzed by the bug reporters, this issue could lead to phantomentries in the database list maintained by the autovacuum launcher(in rebuild_database_list()) if the database dropped was part of thedatabase list when it was still valid. After the database was dropped,it would remain the highest on the list of databases to considered bythe autovacuum worker as things to process. This would preventautovacuum jobs to happen on all the other databases still present.The commit fixes this issue by delaying setting MyDatabaseId until thedatabase existence has been re-checked with the second scan onpg_database after getting a shared lock on it, and by switchingpgstat_update_dbstats() so as nothing happens if MyDatabaseId is notvalid.Issue introduced by5891c7a, so backpatch down to 15.Reported-by: Will Mortensen, Jacob SpeidelAnalyzed-by: Will Mortensen, Jacob SpeidelAuthor: Andres FreundDiscussion:https://postgr.es/m/17973-bca1f7d5c14f601e@postgresql.orgBackpatch-through: 151 parentd0ec2dd commit2b8e527
2 files changed
+74
-57
lines changedLines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
271 | 271 |
| |
272 | 272 |
| |
273 | 273 |
| |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
274 | 281 |
| |
275 | 282 |
| |
276 | 283 |
| |
| |||
327 | 334 |
| |
328 | 335 |
| |
329 | 336 |
| |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
330 | 343 |
| |
331 | 344 |
| |
332 | 345 |
| |
|
Lines changed: 61 additions & 57 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1006 | 1006 |
| |
1007 | 1007 |
| |
1008 | 1008 |
| |
1009 |
| - | |
| 1009 | + | |
1010 | 1010 |
| |
1011 | 1011 |
| |
1012 | 1012 |
| |
| |||
1020 | 1020 |
| |
1021 | 1021 |
| |
1022 | 1022 |
| |
1023 |
| - | |
1024 |
| - | |
1025 |
| - | |
1026 |
| - | |
| 1023 | + | |
1027 | 1024 |
| |
1028 |
| - | |
1029 |
| - | |
1030 |
| - | |
1031 |
| - | |
1032 |
| - | |
1033 |
| - | |
1034 |
| - | |
1035 |
| - | |
1036 |
| - | |
1037 |
| - | |
1038 |
| - | |
1039 |
| - | |
1040 |
| - | |
1041 |
| - | |
1042 |
| - | |
1043 |
| - | |
1044 |
| - | |
1045 |
| - | |
1046 |
| - | |
1047 |
| - | |
1048 |
| - | |
| 1025 | + | |
1049 | 1026 |
| |
1050 | 1027 |
| |
1051 | 1028 |
| |
| |||
1083 | 1060 |
| |
1084 | 1061 |
| |
1085 | 1062 |
| |
1086 |
| - | |
1087 |
| - | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
1088 | 1121 |
| |
1089 | 1122 |
| |
1090 | 1123 |
| |
| |||
1108 | 1141 |
| |
1109 | 1142 |
| |
1110 | 1143 |
| |
1111 |
| - | |
1112 |
| - | |
1113 |
| - | |
1114 |
| - | |
1115 |
| - | |
1116 |
| - | |
1117 |
| - | |
1118 |
| - | |
1119 |
| - | |
1120 |
| - | |
1121 |
| - | |
1122 |
| - | |
1123 |
| - | |
1124 |
| - | |
1125 |
| - | |
1126 |
| - | |
1127 |
| - | |
1128 |
| - | |
1129 |
| - | |
1130 |
| - | |
1131 |
| - | |
1132 |
| - | |
1133 |
| - | |
1134 |
| - | |
1135 |
| - | |
1136 |
| - | |
1137 |
| - | |
1138 |
| - | |
1139 |
| - | |
1140 | 1144 |
| |
1141 | 1145 |
| |
1142 | 1146 |
| |
|
0 commit comments
Comments
(0)