pgsql: Prevent "snapshot too old" from trying to return pruned TOAST tu

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Prevent "snapshot too old" from trying to return pruned TOAST tu
Date: 2016-08-03 20:52:34
Message-ID: E1bV39W-0008CE-VK@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Prevent "snapshot too old" from trying to return pruned TOAST tuples.

Previously, we tested for MVCC snapshots to see whether they were too
old, but not TOAST snapshots, which can lead to complaints about missing
TOAST chunks if those chunks are subject to early pruning. Ideally,
the threshold lsn and timestamp for a TOAST snapshot would be that of
the corresponding MVCC snapshot, but since we have no way of deciding
which MVCC snapshot was used to fetch the TOAST pointer, use the oldest
active or registered snapshot instead.

Reported by Andres Freund, who also sketched out what the fix should
look like. Patch by me, reviewed by Amit Kapila.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/3e2f3c2e423b3ae906668c186bac79522b8e3e29

Modified Files
--------------
src/backend/access/heap/tuptoaster.c | 37 +++++++++++++++++++++++++++++++----
src/backend/utils/time/snapmgr.c | 38 ++++++++++++++++++++++++++++++++++++
src/backend/utils/time/tqual.c | 1 -
src/include/storage/bufmgr.h | 3 ++-
src/include/utils/snapmgr.h | 1 +
src/include/utils/tqual.h | 32 ++++++++++++++++++++----------
6 files changed, 96 insertions(+), 16 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2016-08-03 21:02:27 pgsql: doc: Move indexterms to avoid whitespace issue in man pages
Previous Message Tom Lane 2016-08-03 20:37:08 pgsql: Make INSERT-from-multiple-VALUES-rows handle targetlist indirect

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2016-08-03 21:00:02 Re: Implementing full UTF-8 support (aka supporting 0x00)
Previous Message Kevin Grittner 2016-08-03 20:51:25 Re: Why we lost Uber as a user