forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite7ec022
committed
Fix longstanding problems in VACUUM caused by untimely interruptions
In VACUUM FULL, an interrupt after the initial transaction has been recordedas committed can cause postmaster to restart with the following error message:PANIC: cannot abort transaction NNNN, it was already committedThis problem has been reported many times.In lazy VACUUM, an interrupt after the table has been truncated bylazy_truncate_heap causes other backends' relcache to still point to theremoved pages; this can cause future INSERT and UPDATE queries to error outwith the following error message:could not read block XX of relation 1663/NNN/MMMM: read only 0 of 8192 bytesThe window to this race condition is extremely narrow, but it has been seen inthe wild involving a cancelled autovacuum process.The solution for both problems is to inhibit interrupts in both operationsuntil after the respective transactions have been committed. It's not acomplete solution, because the transaction could theoretically be aborted bysome other error, but at least fixes the most common causes of both problems.1 parentb538b72 commite7ec022
File tree
3 files changed
+50
-13
lines changed- src
- backend/commands
- include/commands
3 files changed
+50
-13
lines changedLines changed: 30 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
16 |
| - | |
| 16 | + | |
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
| |||
217 | 217 |
| |
218 | 218 |
| |
219 | 219 |
| |
220 |
| - | |
| 220 | + | |
221 | 221 |
| |
222 | 222 |
| |
223 |
| - | |
| 223 | + | |
224 | 224 |
| |
225 | 225 |
| |
226 | 226 |
| |
| |||
1020 | 1020 |
| |
1021 | 1021 |
| |
1022 | 1022 |
| |
| 1023 | + | |
1023 | 1024 |
| |
1024 | 1025 |
| |
1025 | 1026 |
| |
| |||
1186 | 1187 |
| |
1187 | 1188 |
| |
1188 | 1189 |
| |
1189 |
| - | |
| 1190 | + | |
1190 | 1191 |
| |
1191 |
| - | |
| 1192 | + | |
1192 | 1193 |
| |
1193 | 1194 |
| |
1194 | 1195 |
| |
| |||
1202 | 1203 |
| |
1203 | 1204 |
| |
1204 | 1205 |
| |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
1205 | 1210 |
| |
1206 | 1211 |
| |
1207 | 1212 |
| |
| |||
1235 | 1240 |
| |
1236 | 1241 |
| |
1237 | 1242 |
| |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
1238 | 1246 |
| |
1239 |
| - | |
| 1247 | + | |
1240 | 1248 |
| |
1241 | 1249 |
| |
1242 | 1250 |
| |
| |||
1247 | 1255 |
| |
1248 | 1256 |
| |
1249 | 1257 |
| |
| 1258 | + | |
1250 | 1259 |
| |
1251 | 1260 |
| |
1252 | 1261 |
| |
| |||
1298 | 1307 |
| |
1299 | 1308 |
| |
1300 | 1309 |
| |
1301 |
| - | |
| 1310 | + | |
1302 | 1311 |
| |
1303 | 1312 |
| |
1304 | 1313 |
| |
| |||
1324 | 1333 |
| |
1325 | 1334 |
| |
1326 | 1335 |
| |
| 1336 | + | |
| 1337 | + | |
1327 | 1338 |
| |
1328 | 1339 |
| |
1329 | 1340 |
| |
| |||
1874 | 1885 |
| |
1875 | 1886 |
| |
1876 | 1887 |
| |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
1877 | 1891 |
| |
1878 |
| - | |
| 1892 | + | |
1879 | 1893 |
| |
1880 | 1894 |
| |
1881 | 1895 |
| |
| |||
1900 | 1914 |
| |
1901 | 1915 |
| |
1902 | 1916 |
| |
| 1917 | + | |
1903 | 1918 |
| |
1904 | 1919 |
| |
1905 | 1920 |
| |
| |||
2705 | 2720 |
| |
2706 | 2721 |
| |
2707 | 2722 |
| |
2708 |
| - | |
| 2723 | + | |
| 2724 | + | |
| 2725 | + | |
2709 | 2726 |
| |
| 2727 | + | |
| 2728 | + | |
2710 | 2729 |
| |
2711 | 2730 |
| |
2712 | 2731 |
| |
| |||
2906 | 2925 |
| |
2907 | 2926 |
| |
2908 | 2927 |
| |
| 2928 | + | |
| 2929 | + | |
2909 | 2930 |
| |
2910 | 2931 |
| |
2911 | 2932 |
| |
|
Lines changed: 18 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 |
| - | |
| 32 | + | |
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
| |||
140 | 140 |
| |
141 | 141 |
| |
142 | 142 |
| |
| 143 | + | |
| 144 | + | |
| 145 | + | |
143 | 146 |
| |
144 |
| - | |
| 147 | + | |
145 | 148 |
| |
146 | 149 |
| |
147 | 150 |
| |
| |||
153 | 156 |
| |
154 | 157 |
| |
155 | 158 |
| |
| 159 | + | |
156 | 160 |
| |
157 | 161 |
| |
158 | 162 |
| |
| |||
194 | 198 |
| |
195 | 199 |
| |
196 | 200 |
| |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
197 | 207 |
| |
198 | 208 |
| |
199 | 209 |
| |
200 | 210 |
| |
201 | 211 |
| |
| 212 | + | |
| 213 | + | |
| 214 | + | |
202 | 215 |
| |
| 216 | + | |
203 | 217 |
| |
204 | 218 |
| |
205 | 219 |
| |
| |||
246 | 260 |
| |
247 | 261 |
| |
248 | 262 |
| |
| 263 | + | |
| 264 | + | |
249 | 265 |
| |
250 | 266 |
| |
251 | 267 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
146 | 146 |
| |
147 | 147 |
| |
148 | 148 |
| |
149 |
| - | |
| 149 | + | |
150 | 150 |
| |
151 | 151 |
| |
152 | 152 |
| |
|
0 commit comments
Comments
(0)