RE: BUG: Former primary node might stuck when started as a standby

Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>

From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: 'Alexander Lakhin' <exclusion@gmail.com>, Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>, Aleksander Alekseev <aleksander@timescale.com>
Date: 2026-03-03T09:17:16Z
Lists: pgsql-hackers
Dear Alexander,


> FWIW, 004_timeline_switch also failed the past month in the same way [2].

Thanks for the info. So I can provide the patch after the issue for 009_twophase.pl
is fixed. For better understanding we may be able to fork new thread.

> I've just tested 012_subtransactions.pl with the script I proposed at [3]
> and it passed 100 iterations (because it performs $node_primary->stop;
> before $node_standby->promote;, I suppose).

I guess so. cluster::stop does the `pg_ctl stop -m fast` command. In this case
the walsender waits till there are nothing to be sent, see WalSndLoop().
Do let me know if you have observed the similar failure here.

Best regards,
Hayato Kuroda
FUJITSU LIMITED

Commits

  1. Fix rare instability in recovery TAP test 004_timeline_switch

  2. Fix rare instability in recovery TAP test 009_twophase