On Wed, Feb 10, 2021 at 7:10 PM Peter Geoghegan <p...@bowt.ie> wrote: > Attached is v3 of the index. I'll describe the changes I made in more > detail in my response to your points below.
I forget to mention that v3 adds several assertions like this one: Assert(!_bt_page_recyclable(BufferGetPage(buf))); These appear at a few key points inside generic routines like _bt_getbuf(). The overall effect is that every nbtree buffer access (with the exception of buffer accesses by VACUUM) will make sure that the page that they're about to access is not recyclable (a page that an index scan lands on might be half-dead or deleted, but it had better not be recyclable). This can probably catch problems with recycling pages too early, such as the problem fixed by commit d3abbbeb back in 2012. Any similar bugs in this area that may appear in the future can be expected to be very subtle, for a few reasons. For one, a page can be recyclable but not yet entered into the FSM by VACUUM for a long time. (I could go on.) The assertions dramatically improve our chances of catching problems like that early. -- Peter Geoghegan