Re: [BUG] Panic due to incorrect missingContrecPtr after promotion
Sami Imseih <simseih@amazon.com>
From: "Imseih (AWS), Sami" <simseih@amazon.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>, "alvherre@alvh.no-ip.org" <alvherre@alvh.no-ip.org>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2022-05-27T02:01:27Z
Lists: pgsql-hackers
Attachments
- 0001-Testing_patch[2][2].patch (application/octet-stream) patch 0001
After further research, we found the following.
Testing on 13.6 with the attached patch we see
that the missingContrecPtr is being incorrectly
set on the standby and the promote in the tap
test fails.
Per the comments in xlog.c, the
missingContrecPtr should not be set when
in standby mode.
/*
* When not in standby mode we find that WAL ends in an incomplete
* record, keep track of that record. After recovery is done,
* we'll write a record to indicate downstream WAL readers that
* that portion is to be ignored.
*/
if (!StandbyMode &&
!XLogRecPtrIsInvalid(xlogreader->abortedRecPtr))
{
abortedRecPtr = xlogreader->abortedRecPtr;
missingContrecPtr = xlogreader->missingContrecPtr;
elog(LOG, "missingContrecPtr == %ld", missingContrecPtr);
}
If StandbyModeRequested is checked instead, which
checks for the presence of a standby signal file,
The missingContrecPtr is not set on the
standby and the test succeeds.
if (!StandbyModeRequested &&
!XLogRecPtrIsInvalid(xlogreader->abortedRecPtr))
{
abortedRecPtr = xlogreader->abortedRecPtr;
missingContrecPtr = xlogreader->missingContrecPtr;
elog(LOG, "missingContrecPtr == %ld", missingContrecPtr);
}
If this is a bug as it appears, it appears the original patch
to resolve this issue is not needed and the ideal fix
Is to ensure that a standby does not set
missingContrecPtr.
Would like to see what others think.
Thanks
--
Sami Imseih
Amazon Web Services
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