From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Andreas Seltenreich <seltenreich@gmx.de>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: [sqlsmith] Crash in GetOldestSnapshot()
Date: Sat, 06 Aug 2016 14:00:51 +0100
Message-ID: <87zioqcbbv.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <CAA4eK1LiRxT_iPfJ=uK13tLCtaGAQqn_YOY=6zCBqoi2mW333A@mail.gmail.com>
References: <87vazemeda.fsf@credativ.de>
<874m6ydrna.fsf@news-spur.riddles.org.uk>
<CAA4eK1LiRxT_iPfJ=uK13tLCtaGAQqn_YOY=6zCBqoi2mW333A@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
>>>>> "Amit" == Amit Kapila <amit.kapila16@gmail.com> writes:
Amit> Sure, that is the reason of crash, but even if we do that it will
Amit> lead to an error "no known snapshots". Here, what is going on is
Amit> that we initialized toast snapshot when there is no active
Amit> snapshot in the backend, so GetOldestSnapshot() won't return any
Amit> snapshot.
Hmm.
So this happens because RETURNING queries run to completion immediately
and populate a tuplestore with the results, and the portal then fetches
from the tuplestore to send to the destination. The assumption is that
the tuplestore output can be processed without needing a snapshot, which
obviously is not true now if it contains toasted data.
In a similar case in the past involving holdable cursors, the solution
was to detoast _before_ storing in the tuplestore (see
PersistHoldablePortal). I guess the question now is, under what
circumstances is it now allowable to detoast a datum with no active
snapshot? (Wouldn't it be necessary in such a case to know what the
oldest snapshot ever used in the transaction was?)
Amit> I think for such situations, we need to initialize the lsn and
Amit> whenTaken of ToastSnapshot as we do in GetSnapshotData() [1].
Would that not give a too-recent LSN, resulting in possibly failing to
fetch the toast rows?
--
Andrew (irc:RhodiumToad)
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: andrew@tao11.riddles.org.uk, amit.kapila16@gmail.com, seltenreich@gmx.de
Subject: Re: [sqlsmith] Crash in GetOldestSnapshot()
In-Reply-To: <87zioqcbbv.fsf@news-spur.riddles.org.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox