Re: BUG #18280: logical decoding build wrong snapshot for subtransactions - Mailing list pgsql-bugs

From Amit Kapila
Subject Re: BUG #18280: logical decoding build wrong snapshot for subtransactions
Date
Msg-id CAA4eK1KULrO8H4nzosuDiV0tAVHpHLuFFcvQA7JB125Qbhc6OQ@mail.gmail.com
Whole thread Raw
In response to RE: BUG #18280: logical decoding build wrong snapshot for subtransactions  ("Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>)
Responses RE: BUG #18280: logical decoding build wrong snapshot for subtransactions
Re: BUG #18280: logical decoding build wrong snapshot for subtransactions
List pgsql-bugs
On Tue, Jan 23, 2024 at 6:03 PM Hayato Kuroda (Fujitsu)
<kuroda.hayato@fujitsu.com> wrote:
>
> Thanks for reporting the bug. I could reproduce the issue with your reproducer.
> I agreed your point.
>
> > Thanks, your analysis sounds correct to me. BTW, I think this should
> > occur only in 15 and 14 because in prior branches we didn't check if
> > the xact has catalog changes before marking its subxacts. From 16
> > onwards, we already accurately serialize the xacts and subxacts that
> > have made any catalog changes, so this problem shouldn't be there. Can
> > you please once verify the same?
>
> I tested PG16-PG13 and got below result. As you said, only the ERROR happened
> only on PG14 and PG15.
>

While looking closely at the test result, I wondered how the following
part of test "s0_begin" "s0_truncate" "s1_checkpoint" "s1_get_changes"
"s0_insert_part" "s1_get_changes" "s0_commit" can see the insert when
the containing transaction is not yet committed. Then, I found it is
because the insert is performed from session 1 due to way it is
declared.

session "s1"
...
step "s1_get_changes" { SELECT data FROM
pg_logical_slot_get_changes('isolation_slot', NULL, NULL,
'skip-empty-xacts', '1', 'include-xids', '0'); }
+step "s0_insert_part" { INSERT INTO tbl1_part VALUES (1); }

I think this session should be performed from seesion-1 and we need
one more get_changes() call to see the problem. I have modified the
test accordingly and also changed the comments. See the attached and
let me know what you people think.

--
With Regards,
Amit Kapila.

Attachment

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #18308: SQL query information_schema metadata got error: server process was terminated by signal 11: Segment
Next
From: Christoph Berg
Date:
Subject: Re: Misleading/inaccurate error message from pg_basebackup