Re: Slow catchup of 2PC (twophase) transactions on replica in LR

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Cc: Peter Smith <smithpb2250@gmail.com>, "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, Vitaly Davydov <v.davydov@postgrespro.ru>, Ajin Cherian <itsajin@gmail.com>
Date: 2024-07-22T06:57:26Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix random failure in 021_twophase.

  2. Allow altering of two_phase option of a SUBSCRIPTION.

  3. Doc: use true|false rather than on|off for "failover" option

  4. Support an optional asynchronous commit mode, in which we don't flush WAL

Attachments

On Mon, Jul 22, 2024 at 8:26 AM Hayato Kuroda (Fujitsu)
<kuroda.hayato@fujitsu.com> wrote:
>
> ```
> @@ -1089,6 +1089,12 @@ CheckAlterSubOption(Subscription *sub, const char *option,
>       * is because both failover and two_phase options of the slot on the
>       * publisher cannot be modified if the slot is currently acquired by the
>       * existing walsender.
> +     *
> +     * XXX: when toggling two_phase from "false" to "true", the slot parameter
> +     * is not modified by the backend process so that the lock conflict won't
> +     * occur. The restarted walsender will do the alternation. Therefore, we
> +     * can allow to switch without the restriction. This can be changed in
> +     * the future based on the requirement.
> ```
>
>

I used a slightly different comment in the attached. Apart from this,
I also addressed comments by Vignesh and Peter. Let me know if I
missed anything.

-- 
With Regards,
Amit Kapila.