Skip to content

Commit 2d60ce3

Browse files
committed
Report any XLogReadRecord() error in XlogReadTwoPhaseData().
Buildfarm members kittiwake and tadarida have witnessed errors at this site. The site discarded key facts. Back-patch to v10 (all supported versions). Reviewed by Michael Paquier and Tom Lane. Discussion: https://postgr.es/m/20211107013157.GB790288@rfd.leadboat.com
1 parent de34381 commit 2d60ce3

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/backend/access/transam/twophase.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,11 +1465,21 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len)
14651465
ThisTimeLineID = save_currtli;
14661466

14671467
if (record == NULL)
1468-
ereport(ERROR,
1469-
(errcode_for_file_access(),
1470-
errmsg("could not read two-phase state from WAL at %X/%X",
1471-
(uint32) (lsn >> 32),
1472-
(uint32) lsn)));
1468+
{
1469+
if (errormsg)
1470+
ereport(ERROR,
1471+
(errcode_for_file_access(),
1472+
errmsg("could not read two-phase state from WAL at %X/%X: %s",
1473+
(uint32) (lsn >> 32),
1474+
(uint32) lsn,
1475+
errormsg)));
1476+
else
1477+
ereport(ERROR,
1478+
(errcode_for_file_access(),
1479+
errmsg("could not read two-phase state from WAL at %X/%X",
1480+
(uint32) (lsn >> 32),
1481+
(uint32) lsn)));
1482+
}
14731483

14741484
if (XLogRecGetRmid(xlogreader) != RM_XACT_ID ||
14751485
(XLogRecGetInfo(xlogreader) & XLOG_XACT_OPMASK) != XLOG_XACT_PREPARE)

0 commit comments

Comments
 (0)