pgsql: Fix nbtree kill_prior_tuple posting list assert. - Mailing list pgsql-committers

From Peter Geoghegan
Subject pgsql: Fix nbtree kill_prior_tuple posting list assert.
Date
Msg-id E1jLZa8-0001IK-OK@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Tomas Vondra
Date:
Subject: pgsql: Fix show_incremental_sort_info with force_parallel_mode
Next
From: Tomas Vondra
Date:
Subject: pgsql: Fix failures in incremental_sort due to number of workers