Re: Bug in logical decoding with DDL and subtransactions

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, Bingshuai Li <lucian1412(at)outlook(dot)com>, "alvherre(at)kurilemu(dot)de" <alvherre(at)kurilemu(dot)de>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "mark(dot)dilger(at)enterprisedb(dot)com" <mark(dot)dilger(at)enterprisedb(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>, "a(dot)kozhemyakin(at)postgrespro(dot)ru" <a(dot)kozhemyakin(at)postgrespro(dot)ru>
Subject: Re: Bug in logical decoding with DDL and subtransactions
Date: 2026-09-30 05:07:33
Message-ID: aryZFSdaUxrONyS_@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 30, 2026 at 12:05:09PM +0900, Michael Paquier wrote:
> On Tue, Sep 29, 2026 at 05:17:19PM -0400, Tom Lane wrote:
>> Given that the problem is expensive to reproduce, I doubt that
>> bisecting to identify this still-hypothetical commit is worth the
>> trouble; I was just curious to know if anyone already understood the
>> connection. Now, if it turns out that Bingshuai's patch doesn't make
>> prion happy, then we'll need to dig deeper.
>
> It's not that hard to reach. If I run three check-world builds in
> parallel to load my laptop CPU (say HEAD, v19 and v18 with a
> worktree), HEAD is able to fail rather reliably like 30%~40% of the
> time, on this test. The problem is very easy to reach for the last
> two weeks.

There is cheap way to reproduce the issue, as of two
pg_log_standby_snapshot() in ddl.sql:
@@ -231,6 +231,7 @@ ROLLBACK TO SAVEPOINT b;
INSERT INTO tr_sub(path) VALUES ('3-top-2-#2');
COMMIT;

+SELECT pg_log_standby_snapshot() IS NOT NULL;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');

-- test whether a known, but not yet logged toplevel xact, followed by a
@@ -250,6 +251,7 @@ INSERT INTO tr_sub(path) VALUES ('5-top-1-#1');
COMMIT;


+SELECT pg_log_standby_snapshot() IS NOT NULL;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');

-- check that DDL in aborted subtransactions handled correctly

See also the attached. This stuff reproduces quickly the assertion
failure.
--
Michael

Attachment Content-Type Size
ddl.diff.txt text/plain 873 bytes

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-09-30 05:09:41 REPACK (CONCURRENTLY): do not block the table while waiting for the final lock
Previous Message Grigorev Jurij 2026-09-30 04:53:42 Re: meson: pass OpenSSL/ICU include dirs to extensions