From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | vignesh C <vignesh21(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com> |
Subject: | Re: Random subscription 021_twophase test failure on kestrel |
Date: | 2025-05-24 00:37:30 |
Message-ID: | aDEUyt5SzFUOokum@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, May 23, 2025 at 08:55:27PM +0530, vignesh C wrote:
> This issue can be consistently reproduced by injecting a delay (e.g.,
> 3 seconds) in tap_sub's walsender while decoding the commit of
> 'mygid'. A patch to demonstrate this behavior is provided at
> 021_two_phase_test_failure_reproduce.patch. The test can be fixed by
> explicitly waiting for both subscriptions to catch up before dropping
> either. A patch implementing this fix is attached.
+ if (parsed->twophase_xid && strcmp(parsed->twophase_gid, "mygid") == 0 &&
+ strcmp(NameStr(MyReplicationSlot->data.name), "tap_sub") == 0)
+ sleep(3);
+
Smart filtering to prove your point.
> +# Wait for both subscribers to catchup
> $node_publisher->wait_for_catchup($appname_copy);
> +$node_publisher->wait_for_catchup($appname);
> +
> +# Make sure there are no prepared transactions on the subscriber
> +$result = $node_subscriber->safe_psql('postgres',
> + "SELECT count(*) FROM pg_prepared_xacts;");
> +is($result, qq(0), 'should be no prepared transactions on subscriber');
Yes, agreed that your suggested fix looks sensible with an extra check
for pg_prepared_xacts on the subscriber side that can be useful for
debugging. I'll take care of that, if there are no objections.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2025-05-24 00:47:21 | Re: mention unused_oids script in pg_proc.dat |
Previous Message | Michael Paquier | 2025-05-24 00:17:14 | Re: queryId constant squashing does not support prepared statements |