]> granicus.if.org Git - postgresql/commit
Fix race conditions associated with SPGiST redirection tuples.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Aug 2012 19:34:14 +0000 (15:34 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Aug 2012 19:34:14 +0000 (15:34 -0400)
commit962e0cc71e839c58fb9125fa85511b8bbb8bdbee
treee91d54f941d8207c0a48b642fd59fe9fcd46072e
parent7719ed04bc4b8f08dab85ffe9c79a52fdb4756dd
Fix race conditions associated with SPGiST redirection tuples.

The correct test for whether a redirection tuple is removable is whether
tuple's xid < RecentGlobalXmin, not OldestXmin; the previous coding
failed to protect index searches being done in concurrent transactions that
have no XID.  This mirrors the recent fix in btree's page recycling logic
made in commit d3abbbebe52eb1e59e621c880ad57df9d40d13f2.

Also, WAL-log the newest XID of any removed redirection tuple on an index
page, and apply ResolveRecoveryConflictWithSnapshot during InHotStandby WAL
replay.  This protects against concurrent Hot Standby transactions possibly
needing to see the redirection tuple(s).

Per my query of 2012-03-12 and subsequent discussion.
src/backend/access/spgist/spgutils.c
src/backend/access/spgist/spgvacuum.c
src/backend/access/spgist/spgxlog.c
src/include/access/spgist_private.h