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: vignesh C <vignesh21@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Smith <smithpb2250@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.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-30T10:58:17Z
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 →
-
Fix random failure in 021_twophase.
- 0dcea330babd 18.0 landed
-
Allow altering of two_phase option of a SUBSCRIPTION.
- 1462aad2e447 18.0 landed
-
Doc: use true|false rather than on|off for "failover" option
- fa65a022db26 17.0 cited
-
Support an optional asynchronous commit mode, in which we don't flush WAL
- 4a78cdeb6b59 8.3.0 cited
On Tue, Jul 30, 2024 at 4:02 PM vignesh C <vignesh21@gmail.com> wrote:
>
> On Thu, 25 Jul 2024 at 08:39, Amit Kapila <amit.kapila16@gmail.com> wrote:
> >
> > On Wed, Jul 24, 2024 at 9:13 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > >
> > > Amit Kapila <amit.kapila16@gmail.com> writes:
> > > > I merged these changes, made a few other cosmetic changes, and pushed the patch.
> > >
> > > There is a CF entry pointing at this thread [1]. Should it be closed?
> > >
> >
> > Yes, closed now. Thanks for the reminder.
>
> I noticed one random test failure in my environment with 021_twophase test.
> [10:37:01.131](0.053s) ok 24 - should be no prepared transactions on subscriber
> error running SQL: 'psql:<stdin>:2: ERROR: cannot alter two_phase
> when logical replication worker is still running
> HINT: Try again after some time.'
>
> We can reproduce the issue by adding a delay at apply_worker_exit like
> in the attached Reproduce_random_021_twophase_test_failure.patch
> patch.
>
> This is happening because the check here is wrong:
> +$node_subscriber->poll_query_until('postgres',
> + "SELECT count(*) = 0 FROM pg_stat_activity WHERE backend_type =
> 'logical replication worker'"
>
> Here "logical replication worker" should be "logical replication apply worker".
>
> Attached patch has the changes for the same.
>
LGTM.
--
With Regards,
Amit Kapila.