Skip to content

Commit d4e9d69

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 13c8adf commit d4e9d69

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
@@ -1414,11 +1414,21 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len)
14141414
ThisTimeLineID = save_currtli;
14151415

14161416
if (record == NULL)
1417-
ereport(ERROR,
1418-
(errcode_for_file_access(),
1419-
errmsg("could not read two-phase state from WAL at %X/%X",
1420-
(uint32) (lsn >> 32),
1421-
(uint32) lsn)));
1417+
{
1418+
if (errormsg)
1419+
ereport(ERROR,
1420+
(errcode_for_file_access(),
1421+
errmsg("could not read two-phase state from WAL at %X/%X: %s",
1422+
(uint32) (lsn >> 32),
1423+
(uint32) lsn,
1424+
errormsg)));
1425+
else
1426+
ereport(ERROR,
1427+
(errcode_for_file_access(),
1428+
errmsg("could not read two-phase state from WAL at %X/%X",
1429+
(uint32) (lsn >> 32),
1430+
(uint32) lsn)));
1431+
}
14221432

14231433
if (XLogRecGetRmid(xlogreader) != RM_XACT_ID ||
14241434
(XLogRecGetInfo(xlogreader) & XLOG_XACT_OPMASK) != XLOG_XACT_PREPARE)

0 commit comments

Comments
 (0)