Re: [BUG] recovery of prepared transactions during promotion can fail

Julian Markwort <julian.markwort@cybertec.at>

From: Julian Markwort <julian.markwort@cybertec.at>
To: Michael Paquier <michael@paquier.xyz>, Nathan Bossart <nathandbossart@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-06-21T09:11:55Z
Lists: pgsql-hackers

Attachments

First off, thanks for the quick reaction and reviews, I appreciate it.

On Wed, 2023-06-21 at 14:14 +0900, Michael Paquier wrote:
> But that won't connect work as the segment requested is now a partial
> one in the primary's pg_wal, still the standby wants it.

I think since 009_twophase.pl doesn't use archiving so far, it's not a good idea to enable it generally, for all those
tests. It changes too much of the behaviour.

> I think that it is better
> for now to just undo has_archiving in has_archiving, and tackle the
> coverage with a separate test, perhaps only for HEAD.

I see you've already undone it.
Attached is a patch for 009_twophase.pl to just try this corner case at the very end, so as not to influence other
existing tests in suite.

When I run this on REL_14_8 I get the error again, sort of as a sanity check...

Kind regards
Julian

Commits

  1. Disable use of archiving in 009_twophase.pl

  2. Enable archiving in recovery TAP test 009_twophase.pl

  3. Fix failure at promotion with 2PC transactions and archiving enabled

  4. Postpone some end-of-recovery operations related to allowing WAL.

  5. Refactor some end-of-recovery code out of StartupXLOG().