Re: BUG #18641: Logical decoding of two-phase commit fails with TOASTed default values

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Takeshi Ideriha <iderihatakeshi(at)gmail(dot)com>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18641: Logical decoding of two-phase commit fails with TOASTed default values
Date: 2024-09-30 16:20:00
Message-ID: CAA4eK1K5X2AmaMbWnjT-L=r9BE-qN+B+A8ebZqRqWku-+BYUjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Mon, Sep 30, 2024 at 6:46 AM Takeshi Ideriha
<iderihatakeshi(at)gmail(dot)com> wrote:
>
> Thank you for reporting the issue.
> I was able to reproduce the issue by modifying 022_twophase_cascade.pl
> accordingly.
>
> The scan for toast index is actually done under systable_getnext_ordered,
> where HandleConcurrentAbort() is called. So it seems to me that this
> scan is actually safe for concurrent abort in logical decoding.
> Logic around HandleConcurrentAbort is intorduced
> https://github.com/postgres/postgres/commit/7259736a6e5b7c7588fff9578370736a6648acbb.
>
> Though I may not understand the logic around HandleConcurrentAbort
> fully and I am not sure not-setting bsysscan at
> systable_beginscan_ordered is intentional,
> it seems to me setting and unsetting a bsysscan flag in
> systable_beginscan_ordered and systable_endscan_ordered would resolve
> the issue.
>

We forgot to set/unset the flag in functions
systable_beginscan_ordered and systable_endscan_ordered. BTW,
shouldn't this occur even without prepare transaction? If so, we need
to backpatch this till 14.

Also, it is better to have a test for this, and let's ensure that the
new test doesn't increase the regression time too much if possible.

One minor point:
+
+ /*
+ * If CheckXidAlive is set then set a flag to indicate that system table

The indentation in the first comment line seems off.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Fujii Masao 2024-09-30 17:07:18 Re: vacuumdb: permission denied for schema "pg_temp_7"
Previous Message Tom Lane 2024-09-30 14:00:44 Re: BUG #18642: Creating a materialized view on top of ts_stat succeeds on 16.4, but it fails on 17.0

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2024-09-30 16:34:22 Re: pg_basebackup and error messages dependent on the order of the arguments
Previous Message Tom Lane 2024-09-30 16:08:11 Re: pg_walsummary, Character-not-present-in-option