Skip to content

Commit cae393f

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 56c5a06 commit cae393f

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

14561456
if (record == NULL)
1457-
ereport(ERROR,
1458-
(errcode_for_file_access(),
1459-
errmsg("could not read two-phase state from WAL at %X/%X",
1460-
(uint32) (lsn >> 32),
1461-
(uint32) lsn)));
1457+
{
1458+
if (errormsg)
1459+
ereport(ERROR,
1460+
(errcode_for_file_access(),
1461+
errmsg("could not read two-phase state from WAL at %X/%X: %s",
1462+
(uint32) (lsn >> 32),
1463+
(uint32) lsn,
1464+
errormsg)));
1465+
else
1466+
ereport(ERROR,
1467+
(errcode_for_file_access(),
1468+
errmsg("could not read two-phase state from WAL at %X/%X",
1469+
(uint32) (lsn >> 32),
1470+
(uint32) lsn)));
1471+
}
14621472

14631473
if (XLogRecGetRmid(xlogreader) != RM_XACT_ID ||
14641474
(XLogRecGetInfo(xlogreader) & XLOG_XACT_OPMASK) != XLOG_XACT_PREPARE)

0 commit comments

Comments
 (0)