pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Noah Misch <noah@leadboat.com>
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: Fri, 22 Aug 2025 13:36:29 +0300
Message-ID: <1cc5c19e-c9fd-4abe-a528-f5c60c8dab3d@iki.fi> (raw)
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>

On 20/08/2025 03:37, Noah Misch wrote:
> 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.

Ok, fair. I committed the revert to v18, and the revert + additional 
checks to master.

- Heikki






view thread (24+ messages)  latest in thread

Message-ID: <1cc5c19e-c9fd-4abe-a528-f5c60c8dab3d@iki.fi>
Permalink:  ../1cc5c19e-c9fd-4abe-a528-f5c60c8dab3d@iki.fi/
Also on:    postgresql.org/message-id/1cc5c19e-c9fd-4abe-a528-f5c60c8dab3d@iki.fi

 · 

reply

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: hlinnaka@iki.fi, noah@leadboat.com, andres@anarazel.de, nathandbossart@gmail.com
  Subject: Re: A few patches to clarify snapshot management
  In-Reply-To: <1cc5c19e-c9fd-4abe-a528-f5c60c8dab3d@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> <20250820003756.31.nmisch@google.com> <1cc5c19e-c9fd-4abe-a528-f5c60c8dab3d@iki.fi>

* 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