]> granicus.if.org Git - postgresql/commit
Prevent "snapshot too old" from trying to return pruned TOAST tuples.
authorRobert Haas <rhaas@postgresql.org>
Wed, 3 Aug 2016 20:41:43 +0000 (16:41 -0400)
committerRobert Haas <rhaas@postgresql.org>
Wed, 3 Aug 2016 20:50:01 +0000 (16:50 -0400)
commit3e2f3c2e423b3ae906668c186bac79522b8e3e29
tree0223b912d722860ed070bf95719d52e7a3758090
parenta3c7a993d5eb29df4d33075b83c75ae25f257897
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.
src/backend/access/heap/tuptoaster.c
src/backend/utils/time/snapmgr.c
src/backend/utils/time/tqual.c
src/include/storage/bufmgr.h
src/include/utils/snapmgr.h
src/include/utils/tqual.h