From: Noah Misch <noah@leadboat.com>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Andres Freund <andres@anarazel.de>
Cc: Nathan Bossart <nathandbossart@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: A few patches to clarify snapshot management
Date: Tue, 19 Aug 2025 17:37:56 -0700
Message-ID: <20250820003756.31.nmisch@google.com> (raw)
In-Reply-To: <bc806cb7-843b-4605-8fe4-44b9ceb21500@iki.fi>
References: <7c56f180-b9e1-481e-8c1d-efa63de3ecbb@iki.fi>
<Z2CiGl4ZSODH-Tht@nathan>
<a868fe78-ddb4-4b0a-9b96-873d91d93cfd@iki.fi>
<ydiu2nebkivc5jgxqtynvwfd4ai62rbrqzp6dru5immj3rlrei@rbb7jv7xez7p>
<0cc21d6a-32c4-4d34-9eeb-7a0cf6dca9e8@iki.fi>
<20250809222338.cc.nmisch@google.com>
<217b1d29-a4e5-4b27-8a67-bbeaa20a5609@iki.fi>
<20250819001436.38.nmisch@google.com>
<bc806cb7-843b-4605-8fe4-44b9ceb21500@iki.fi>
On Tue, Aug 19, 2025 at 11:45:01PM +0300, Heikki Linnakangas wrote:
> How about the attached, then? It reverts the GetTransactionSnapshot()
> change. But to still catch at least some of the invalid uses of the historic
> snapshot, it adds checks to heap_beginscan() and index_beginscan(), to
> complain if they are called on a non-catalog relation with a historic
> snapshot.
> @@ -1143,6 +1143,15 @@ heap_beginscan(Relation relation, Snapshot snapshot,
> if (!(snapshot && IsMVCCSnapshot(snapshot)))
> scan->rs_base.rs_flags &= ~SO_ALLOW_PAGEMODE;
>
> + /* Check that a historic snapshot is not used for non-catalog tables */
> + if (snapshot &&
> + IsHistoricMVCCSnapshot(snapshot) &&
> + !RelationIsAccessibleInLogicalDecoding(relation))
> + {
> + elog(ERROR, "cannot query non-catalog table \"%s\" during logical decoding",
> + RelationGetRelationName(relation));
> + }
> +
I feel post-beta3 is late for debut of restrictions like this. How about a
pure revert, then add those restrictions in v19? Should be s/elog/ereport/,
also.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: noah@leadboat.com, hlinnaka@iki.fi, andres@anarazel.de, nathandbossart@gmail.com
Subject: Re: A few patches to clarify snapshot management
In-Reply-To: <20250820003756.31.nmisch@google.com>
References: <7c56f180-b9e1-481e-8c1d-efa63de3ecbb@iki.fi> <Z2CiGl4ZSODH-Tht@nathan> <a868fe78-ddb4-4b0a-9b96-873d91d93cfd@iki.fi> <ydiu2nebkivc5jgxqtynvwfd4ai62rbrqzp6dru5immj3rlrei@rbb7jv7xez7p> <0cc21d6a-32c4-4d34-9eeb-7a0cf6dca9e8@iki.fi> <20250809222338.cc.nmisch@google.com> <217b1d29-a4e5-4b27-8a67-bbeaa20a5609@iki.fi> <20250819001436.38.nmisch@google.com> <bc806cb7-843b-4605-8fe4-44b9ceb21500@iki.fi> <20250820003756.31.nmisch@google.com>
* 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