- Notifications
You must be signed in to change notification settings - Fork28
Commit0408e1e
committed
Do not select new object OIDs that match recently-dead entries.
When selecting a new OID, we take care to avoid picking one that's alreadyin use in the target table, so as not to create duplicates after the OIDcounter has wrapped around. However, up to now we used SnapshotDirty whenscanning for pre-existing entries. That ignores committed-dead rows, sothat we could select an OID matching a deleted-but-not-yet-vacuumed row.While that mostly worked, it has two problems:* If recently deleted, the dead row might still be visible to MVCCsnapshots, creating a risk for duplicate OIDs when examining the catalogswithin our own transaction. Such duplication couldn't be visible outsidethe object-creating transaction, though, and we've heard few if any fieldreports corresponding to such a symptom.* When selecting a TOAST OID, deleted toast rows definitely *are* visibleto SnapshotToast, and will remain so until vacuumed away. This leads toa conflict that will manifest in errors like "unexpected chunk number 0(expected 1) for toast value nnnnn". We've been seeing reports of sucherrors from the field for years, but the cause was unclear before.The fix is simple: just use SnapshotAny to search for conflicting rows.This results in a slightly longer window before object OIDs can berecycled, but that seems unlikely to create any large problems.Pavan DeolaseeDiscussion:https://postgr.es/m/CABOikdOgWT2hHkYG3Wwo2cyZJq2zfs1FH0FgX-=h4OLosXHf9w@mail.gmail.com1 parent811969b commit0408e1e
2 files changed
+12
-11
lines changedLines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1794 | 1794 |
| |
1795 | 1795 |
| |
1796 | 1796 |
| |
1797 |
| - | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
1798 | 1800 |
| |
1799 | 1801 |
| |
1800 | 1802 |
| |
| |||
1806 | 1808 |
| |
1807 | 1809 |
| |
1808 | 1810 |
| |
1809 |
| - | |
1810 | 1811 |
| |
1811 | 1812 |
| |
1812 | 1813 |
| |
| |||
1825 | 1826 |
| |
1826 | 1827 |
| |
1827 | 1828 |
| |
1828 |
| - | |
1829 | 1829 |
| |
1830 | 1830 |
| |
1831 |
| - | |
| 1831 | + | |
1832 | 1832 |
| |
1833 | 1833 |
| |
1834 | 1834 |
| |
|
Lines changed: 8 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
282 | 282 |
| |
283 | 283 |
| |
284 | 284 |
| |
285 |
| - | |
286 |
| - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
287 | 291 |
| |
288 | 292 |
| |
289 | 293 |
| |
| |||
336 | 340 |
| |
337 | 341 |
| |
338 | 342 |
| |
339 |
| - | |
340 | 343 |
| |
341 | 344 |
| |
342 | 345 |
| |
| |||
349 | 352 |
| |
350 | 353 |
| |
351 | 354 |
| |
352 |
| - | |
353 |
| - | |
354 | 355 |
| |
355 | 356 |
| |
356 | 357 |
| |
| |||
363 | 364 |
| |
364 | 365 |
| |
365 | 366 |
| |
366 |
| - | |
| 367 | + | |
367 | 368 |
| |
368 |
| - | |
| 369 | + | |
369 | 370 |
| |
370 | 371 |
| |
371 | 372 |
| |
|
0 commit comments
Comments
(0)