[PATCH v7 2/5] Use correct WAL position in error message on invalid XLOG page header.
Heikki Linnakangas <heikki.linnakangas@iki.fi>
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To:
Date: 2021-11-22T10:13:46Z
Lists: pgsql-hackers
We're using EndRecPtr as an argument to emode_for_corrupt_record(),
which is all about suppressing duplicate complaints about the same
LSN. But if the xlogreader has been repositioned using XLogBeginRead()
since the last call to ReadRecord(), or if there are no preceding
calls to ReadRecord(), then the value of EndRecPtr here is left over
from the previous read position and is not particularly related to the
record we're reading now. xlogreader->EndRecPtr, OTOH, is.
This doesn't seem worth backpatching, but I'm doing this now as a
separate commit because it is needed by the next big refactoring commit.
Author: Robert Haas
Discussion: https://www.postgresql.org/message-id/CA+Tgmoao96EuNeSPd+hspRKcsCddu=b1h-QNRuKfY8VmfNQdfg@mail.gmail.com
---
src/backend/access/transam/xlog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index c42accfa53f..cfccf950dd5 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -12582,7 +12582,7 @@ retry:
* errmsg_internal() because the message was already translated.
*/
if (xlogreader->errormsg_buf[0])
- ereport(emode_for_corrupt_record(emode, EndRecPtr),
+ ereport(emode_for_corrupt_record(emode, xlogreader->EndRecPtr),
(errmsg_internal("%s", xlogreader->errormsg_buf)));
/* reset any error XLogReaderValidatePageHeader() might have set */
--
2.30.2
--------------3904592D294EBE853403D5C1
Content-Type: text/x-patch; charset=UTF-8;
name="v7-0003-Move-code-around-in-StartupXLOG.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="v7-0003-Move-code-around-in-StartupXLOG.patch"