Re: [BUG] Panic due to incorrect missingContrecPtr after promotion
Kyotaro Horiguchi <horikyota.ntt@gmail.com>
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: simseih@amazon.com
Cc: alvherre@alvh.no-ip.org, pgsql-hackers@postgresql.org
Date: 2022-02-24T07:26:42Z
Lists: pgsql-hackers
At Wed, 23 Feb 2022 02:58:07 +0000, "Imseih (AWS), Sami" <simseih@amazon.com> wrote in > > Ooh, nice find and diagnosys. I can confirm that the test fails as you > > described without the code fix, and doesn't fail with it. > > > I attach the same patch, with the test file put in its final place > > rather than as a patch. Due to recent xlog.c changes this need a bit of > > work to apply to back branches; I'll see about getting it in all > > branches soon. > > Thank you for reviewing! Nice catch! However, I'm not sure I like the patch. * made it through and start writing after the portion that persisted. * (It's critical to first write an OVERWRITE_CONTRECORD message, which * we'll do as soon as we're open for writing new WAL.) + * + * If the last wal record is ahead of the missing contrecord, this is a + * recently promoted primary and we should not write an overwrite + * contrecord. Before the part, the comment follows the part shown below. > * Actually, if WAL ended in an incomplete record, skip the parts that So, actually WAL did not ended in an incomplete record. I think FinishWalRecover is the last place to do that. (But it could be earlier.) regards. -- Kyotaro Horiguchi NTT Open Source Software Center
Commits
-
Prevent WAL corruption after a standby promotion.
- 0b3ff539dd34 10.23 landed
- 002fba80ebde 11.18 landed
- 3c0ef0832748 12.13 landed
- 3f2701cda590 13.9 landed
- 0e54a5e27494 14.6 landed
- eb29fa38895c 15.0 landed
- 6672d7913929 16.0 landed
-
Fix "missing continuation record" after standby promotion
- caaeb88ff7ae 14.3 landed
- c714ebd0e8c1 12.11 landed
- 9d92582abf91 15.0 landed
- 9ade3c09a5d1 10.21 landed
- 98eb3e06ce3a 13.7 landed
- 199cd7b59a16 11.16 landed