forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3f58cc6
committed
Remove extra nbtree half-dead internal page check.
It's not safe for nbtree VACUUM to attempt to delete a target page whoseright sibling is already half-dead, since that would fail thecross-check when VACUUM attempts to re-find a downlink to the rightsibling in the parent page. Logic to prevent this from happening wasadded by commit8da3183, which addressed a bug in the overhaul ofpage deletion that went into PostgreSQL 9.4 (commitefada2b).VACUUM was made to check the right sibling page, and back off when ithappened to be half-dead already.However, it is only truly necessary to do the right sibling check on theleaf level, since that transitively determines if the deletion target'sparent's right sibling page is itself undergoing deletion. Remove theinternal page level check, and add a comment explaining why the leaflevel check alone suffices.The extra check is also unnecessary due to the fact that internal pagesthat are marked half-dead are generally considered corrupt. Commitefada2b established the principle that there should never behalf-dead internal pages (internal pages pending deletion are possible,but that status is never directly represented in the internal page).VACUUM will complain about corruption when it encounters half-deadinternal pages, so VACUUM is bound to raise an error one way or anotherwhen an nbtree index has a half-dead internal page (contrib/amcheck willalso report that the page is corrupt).It's possible that a pg_upgrade'd 9.3 database will still have half-deadinternal pages, so it may seem like there is an argument for leaving thecheck in place to reliably get a cleaner error message that advises theuser to REINDEX. However, leaf pages are also deleted in the firstphase of deletion prior to PostgreSQL 9.4, so I believe we won't evenattempt to re-find the parent page anyway (we won't have the fullydeleted leaf page as the right sibling of our target page, so we won'teven try to find a downlink for it).Discussion:https://postgr.es/m/CAH2-Wzm_ntmqJjWLRyKzimFmFvk+BnVAvUpaA4s1h9Ja58woaQ@mail.gmail.com1 parent3922f10 commit3f58cc6
2 files changed
+20
-17
lines changedLines changed: 9 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
262 | 262 |
| |
263 | 263 |
| |
264 | 264 |
| |
265 |
| - | |
266 |
| - | |
267 |
| - | |
268 |
| - | |
269 |
| - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
270 | 274 |
| |
271 | 275 |
| |
272 | 276 |
| |
|
Lines changed: 11 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1301 | 1301 |
| |
1302 | 1302 |
| |
1303 | 1303 |
| |
1304 |
| - | |
1305 |
| - | |
1306 |
| - | |
1307 |
| - | |
1308 |
| - | |
1309 |
| - | |
1310 |
| - | |
1311 |
| - | |
1312 |
| - | |
1313 |
| - | |
1314 |
| - | |
1315 | 1304 |
| |
1316 | 1305 |
| |
1317 | 1306 |
| |
| |||
1621 | 1610 |
| |
1622 | 1611 |
| |
1623 | 1612 |
| |
1624 |
| - | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
1625 | 1624 |
| |
1626 | 1625 |
| |
1627 | 1626 |
| |
|
0 commit comments
Comments
(0)