Fix "failed to re-find parent key" btree VACUUM failure by revising page
Tom Lane <tgl@sss.pgh.pa.us>
Fix "failed to re-find parent key" btree VACUUM failure by revising page deletion code to avoid the case where an upper-level btree page remains "half dead" for a significant period of time, and to block insertions into a key range that is in process of being re-assigned to the right sibling of the deleted page's parent. This prevents the scenario reported by Ed L. wherein index keys could become out-of-order in the grandparent index level. Since this is a moderately invasive fix, I'm applying it only to HEAD. The bug exists back to 7.4, but the back branches will get a different patch.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/nbtree/nbtinsert.c | modified | +3 −3 |
| src/backend/access/nbtree/nbtpage.c | modified | +209 −53 |
| src/backend/access/nbtree/nbtree.c | modified | +4 −5 |
| src/backend/access/nbtree/nbtxlog.c | modified | +124 −58 |
| src/backend/access/nbtree/README | modified | +16 −17 |
| src/include/access/nbtree.h | modified | +7 −3 |