public inbox for [email protected]  
help / color / mirror / Atom feed
From: Erik Rijkers <[email protected]>
To: Matthias van de Meent <[email protected]>
To: Kyotaro Horiguchi <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: TRAP: FailedAssertion("HaveRegisteredOrActiveSnapshot()", File: "toast_internals.c", Line: 670, PID: 19403)
Date: Tue, 29 Mar 2022 13:29:15 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAEze2Wgv4FNYjjtY13HzgC+affAXsSVJYiztrN149B6+O+zq7Q@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CAEze2Wgv4FNYjjtY13HzgC+affAXsSVJYiztrN149B6+O+zq7Q@mail.gmail.com>

Op 29-03-2022 om 12:50 schreef Matthias van de Meent:
> On Tue, 29 Mar 2022 at 11:10, Kyotaro Horiguchi <[email protected]> wrote:
>>
>> At Tue, 29 Mar 2022 17:06:21 +0900 (JST), Kyotaro Horiguchi <[email protected]> wrote in
>>> At Mon, 28 Mar 2022 18:36:46 +0900 (JST), Kyotaro Horiguchi <[email protected]> wrote in
>>> Then, I found that portal->holdSnapshot is that.  I came up with the
>>> attached.  It does the follows:
>>>
>>> 1. Teach PlannedStmtRequiresSnapshot() to return true for FetchStmt.
>>>
>>> 2. Use holdSnapshot in RunFromStore if any.
>>>
>>>
>>> The rerpducer is reduced to as small as the following.
>>>
>>> CREATE TABLE t (a text);
>>> INSERT INTO t VALUES('some random text');
>>> BEGIN;
>>> DECLARE c CURSOR FOR SELECT * FROM t;
>>> FETCH ALL IN c;
>>>
>>> But I haven't come up with a reasonable way to generate the 'some
>>> random text' yet.
>>
>> I gave up and took a straightforward way to generate one.
>>
>> I don't like that it uses a fixed length for the random text, but
>> anyway it works for now...
> 
> An shorter (?) reproducer might be the following, which forces any
> value for 'a' to be toasted and thus triggering the check in
> init_toast_snapshot regardless of value length:
> 
> CREATE TABLE t (a text);
> ALTER TABLE t ALTER COLUMN a SET STORAGE EXTERNAL;
> INSERT INTO t VALUES ('toast');
> BEGIN;
> DECLARE c CURSOR FOR SELECT * FROM t;
> FETCH ALL IN c;

Excellent. That indeed immediately forces the error.

(and the patch prevents it)

Thanks!


> 
> Enjoy,
> 
> -Matthias





view thread (9+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: TRAP: FailedAssertion("HaveRegisteredOrActiveSnapshot()", File: "toast_internals.c", Line: 670, PID: 19403)
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox