pgsql: Preserve toast value OIDs in toast-swap-by-content for CLUSTER/V

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Preserve toast value OIDs in toast-swap-by-content for CLUSTER/V
Date: 2011-08-16 17:48:41
Message-ID: E1QtNkn-0003lM-QS@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Preserve toast value OIDs in toast-swap-by-content for CLUSTER/VACUUM FULL.

This works around the problem that a catalog cache entry might contain a
toast pointer that we try to dereference just as a VACUUM FULL completes
on that catalog. We will see the sinval message on the cache entry when
we acquire lock on the toast table, but by that point we've already told
tuptoaster.c "here's the pointer to fetch", so it's difficult from a code
structural standpoint to update the pointer before we use it. Much less
painful to ensure that toast pointers are not invalidated in the first
place. We have to add a bit of code to deal with the case that a value
that previously wasn't toasted becomes so; but that should be a
seldom-exercised corner case, so the inefficiency shouldn't be significant.

Back-patch to 9.0. In prior versions, we didn't allow CLUSTER on system
catalogs, and VACUUM FULL didn't result in reassignment of toast OIDs, so
there was no problem.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/44b6d53b467bfe848c34c7a8a174779bb2f43c39

Modified Files
--------------
src/backend/access/heap/tuptoaster.c | 122 +++++++++++++++++++++++++++++++---
src/backend/commands/cluster.c | 4 +
2 files changed, 117 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2011-08-16 18:38:55 pgsql: Fix incorrect order of operations during sinval reset processing
Previous Message Tom Lane 2011-08-16 17:13:10 pgsql: Fix race condition in relcache init file invalidation.