Skip to content

Commit 675cd76

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 9aa91cb commit 675cd76

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/backend/access/transam/twophase.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,10 +1409,18 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len)
14091409
ThisTimeLineID = save_currtli;
14101410

14111411
if (record == NULL)
1412-
ereport(ERROR,
1413-
(errcode_for_file_access(),
1414-
errmsg("could not read two-phase state from WAL at %X/%X",
1415-
LSN_FORMAT_ARGS(lsn))));
1412+
{
1413+
if (errormsg)
1414+
ereport(ERROR,
1415+
(errcode_for_file_access(),
1416+
errmsg("could not read two-phase state from WAL at %X/%X: %s",
1417+
LSN_FORMAT_ARGS(lsn), errormsg)));
1418+
else
1419+
ereport(ERROR,
1420+
(errcode_for_file_access(),
1421+
errmsg("could not read two-phase state from WAL at %X/%X",
1422+
LSN_FORMAT_ARGS(lsn))));
1423+
}
14161424

14171425
if (XLogRecGetRmid(xlogreader) != RM_XACT_ID ||
14181426
(XLogRecGetInfo(xlogreader) & XLOG_XACT_OPMASK) != XLOG_XACT_PREPARE)

0 commit comments

Comments
 (0)