forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit08302a3
committed
Don't update relfrozenxid if any pages were skipped.
Vacuum recognizes that it can update relfrozenxid by checking whether it hasprocessed all pages of a relation. Unfortunately it performed that checkafter truncating the dead pages at the end of the relation, and used the newnumber of pages to decide whether all pages have been scanned. If the newnumber of pages happened to be smaller or equal to the number of pagesscanned, it incorrectly decided that all pages were scanned.This can lead to relfrozenxid being updated, even though some pages wereskipped that still contain old XIDs. That can lead to data loss due to xidwraparounds with some rows suddenly missing. This likely has escaped noticeso far because it takes a large number (~2^31) of xids being used to see theeffect, while a full-table vacuum before that would fix the issue.The incorrect logic was introduced by commitb4b6923. Backpatch this fix down to 8.4,like that commit.Andres Freund, with some modifications by me.1 parentdcb0590 commit08302a3
1 file changed
+21
-10
lines changedLines changed: 21 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
178 | 178 |
| |
179 | 179 |
| |
180 | 180 |
| |
181 |
| - | |
| 181 | + | |
| 182 | + | |
182 | 183 |
| |
183 | 184 |
| |
184 | 185 |
| |
| |||
225 | 226 |
| |
226 | 227 |
| |
227 | 228 |
| |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
228 | 244 |
| |
229 | 245 |
| |
230 | 246 |
| |
| |||
254 | 270 |
| |
255 | 271 |
| |
256 | 272 |
| |
257 |
| - | |
258 |
| - | |
| 273 | + | |
| 274 | + | |
259 | 275 |
| |
260 | 276 |
| |
261 | 277 |
| |
| |||
269 | 285 |
| |
270 | 286 |
| |
271 | 287 |
| |
272 |
| - | |
273 |
| - | |
274 |
| - | |
275 |
| - | |
276 |
| - | |
277 |
| - | |
278 |
| - | |
| 288 | + | |
| 289 | + | |
279 | 290 |
| |
280 | 291 |
| |
281 | 292 |
| |
|
0 commit comments
Comments
(0)