- Notifications
You must be signed in to change notification settings - Fork5
Commit7f2a10f
committed
Don't error out if recycling or removing an old WAL segment fails at the end
of checkpoint. Although the checkpoint has been written to WAL at that pointalready, so that all data is safe, and we'll retry removing the WAL segment atthe next checkpoint, if such a failure persists we won't be able to remove anyother old WAL segments either and will eventually run out of disk space. It'sbetter to treat the failure as non-fatal, and move on to clean any other WALsegment and continue with any other end-of-checkpoint cleanup.We don't normally expect any such failures, but on Windows it can happen withsome anti-virus or backup software that lock files without FILE_SHARE_DELETEflag.Also, the loop in pgrename() to retry when the file is locked was broken. If afile is locked on Windows, you get ERROR_SHARE_VIOLATION, notERROR_ACCESS_DENIED, at least on modern versions. Fix that, although I leftthe check for ERROR_ACCESS_DENIED in there as well (presumably it was correctin some environment), and added ERROR_LOCK_VIOLATION to be consistent withsimilar checks in pgwin32_open(). Reduce the timeout on the loop from 30s to10s, on the grounds that since it's been broken, we've effectively had atimeout of 0s and no-one has complained, so a smaller timeout is actuallycloser to the old behavior. A longer timeout would mean that if recycling aWAL file fails because it's locked for some reason, InstallXLogFileSegment()will hold ControlFileLock for longer, potentially blocking other backends, soa long timeout isn't totally harmless.While we're at it, set errno correctly in pgrename().Backpatch to 8.2, which is the oldest version supported on Windows. The xlog.cchanges would make sense on other platforms and thus on older versions aswell, but since there's no such locking issues on other platforms, it's notworth it.1 parentd6119d8 commit7f2a10f
2 files changed
+55
-35
lines changedLines changed: 30 additions & 26 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 |
| |
| |||
2262 | 2262 |
| |
2263 | 2263 |
| |
2264 | 2264 |
| |
2265 |
| - | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
2266 | 2270 |
| |
2267 | 2271 |
| |
2268 | 2272 |
| |
2269 |
| - | |
2270 |
| - | |
2271 | 2273 |
| |
2272 | 2274 |
| |
2273 | 2275 |
| |
| |||
2280 | 2282 |
| |
2281 | 2283 |
| |
2282 | 2284 |
| |
| 2285 | + | |
| 2286 | + | |
2283 | 2287 |
| |
2284 | 2288 |
| |
2285 | 2289 |
| |
| |||
2409 | 2413 |
| |
2410 | 2414 |
| |
2411 | 2415 |
| |
2412 |
| - | |
2413 |
| - | |
2414 |
| - | |
2415 |
| - | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
2416 | 2419 |
| |
2417 | 2420 |
| |
2418 | 2421 |
| |
| |||
2460 | 2463 |
| |
2461 | 2464 |
| |
2462 | 2465 |
| |
2463 |
| - | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
2464 | 2470 |
| |
2465 | 2471 |
| |
2466 | 2472 |
| |
| 2473 | + | |
| 2474 | + | |
2467 | 2475 |
| |
2468 | 2476 |
| |
2469 | 2477 |
| |
2470 | 2478 |
| |
2471 |
| - | |
2472 |
| - | |
2473 |
| - | |
2474 |
| - | |
2475 |
| - | |
2476 |
| - | |
2477 |
| - | |
2478 |
| - | |
2479 |
| - | |
2480 |
| - | |
2481 |
| - | |
2482 |
| - | |
2483 |
| - | |
2484 |
| - | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
2485 | 2482 |
| |
2486 | 2483 |
| |
2487 | 2484 |
| |
| 2485 | + | |
2488 | 2486 |
| |
2489 | 2487 |
| |
2490 | 2488 |
| |
| |||
3128 | 3126 |
| |
3129 | 3127 |
| |
3130 | 3128 |
| |
3131 |
| - | |
| 3129 | + | |
| 3130 | + | |
3132 | 3131 |
| |
3133 |
| - | |
| 3132 | + | |
3134 | 3133 |
| |
| 3134 | + | |
| 3135 | + | |
3135 | 3136 |
| |
3136 | 3137 |
| |
3137 | 3138 |
| |
3138 | 3139 |
| |
3139 | 3140 |
| |
3140 |
| - | |
| 3141 | + | |
| 3142 | + | |
3141 | 3143 |
| |
3142 | 3144 |
| |
3143 | 3145 |
| |
| 3146 | + | |
| 3147 | + | |
3144 | 3148 |
| |
3145 | 3149 |
| |
3146 | 3150 |
| |
|
Lines changed: 25 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| |||
120 | 120 |
| |
121 | 121 |
| |
122 | 122 |
| |
123 |
| - | |
| 123 | + | |
| 124 | + | |
124 | 125 |
| |
125 | 126 |
| |
126 | 127 |
| |
| |||
129 | 130 |
| |
130 | 131 |
| |
131 | 132 |
| |
132 |
| - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
133 | 149 |
| |
134 | 150 |
| |
135 |
| - | |
136 |
| - | |
137 | 151 |
| |
138 |
| - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
139 | 155 |
| |
140 | 156 |
| |
141 | 157 |
| |
| |||
155 | 171 |
| |
156 | 172 |
| |
157 | 173 |
| |
158 |
| - | |
| 174 | + | |
| 175 | + | |
159 | 176 |
| |
160 | 177 |
| |
161 | 178 |
| |
162 | 179 |
| |
163 |
| - | |
164 | 180 |
| |
165 |
| - | |
| 181 | + | |
166 | 182 |
| |
167 | 183 |
| |
168 | 184 |
| |
|
0 commit comments
Comments
(0)