Thread: pgsql: Fix nbtree kill_prior_tuple posting list assert.
Fix nbtree kill_prior_tuple posting list assert. An assertion added by commit 0d861bbb checked that _bt_killitems() only processes a BTScanPosItem whose heap TID is contained in a posting list tuple when its page offset number still matches what is on the page (i.e. when it matches the posting list tuple's current offset number). This was only correct in the common case where the page can't have changed since we first read it. It was not correct in cases where we don't drop the buffer pin (and don't need to verify the page hasn't changed using its LSN). The latter category includes scans involving unlogged tables, and scans that use a non-MVCC snapshot, per the logic originally introduced by commit 2ed5b87f. The assertion still seems helpful. Fix it by taking cases where the page may have been concurrently modified into account. Reported-By: Anastasia Lubennikova, Alexander Lakhin Discussion: https://postgr.es/m/c4e38e9a-0f9c-8e53-e639-adf343f94472@postgrespro.ru Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/ce2cee0ade8a6a360322c51201fda1fc25be7773 Modified Files -------------- src/backend/access/nbtree/nbtutils.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)