Skip to content

Commit 3354746

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 42f9427 commit 3354746

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/backend/access/transam/twophase.c

+12-4
Original file line numberDiff line numberDiff line change
@@ -1397,10 +1397,18 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len)
13971397
record = XLogReadRecord(xlogreader, &errormsg);
13981398

13991399
if (record == NULL)
1400-
ereport(ERROR,
1401-
(errcode_for_file_access(),
1402-
errmsg("could not read two-phase state from WAL at %X/%X",
1403-
LSN_FORMAT_ARGS(lsn))));
1400+
{
1401+
if (errormsg)
1402+
ereport(ERROR,
1403+
(errcode_for_file_access(),
1404+
errmsg("could not read two-phase state from WAL at %X/%X: %s",
1405+
LSN_FORMAT_ARGS(lsn), errormsg)));
1406+
else
1407+
ereport(ERROR,
1408+
(errcode_for_file_access(),
1409+
errmsg("could not read two-phase state from WAL at %X/%X",
1410+
LSN_FORMAT_ARGS(lsn))));
1411+
}
14041412

14051413
if (XLogRecGetRmid(xlogreader) != RM_XACT_ID ||
14061414
(XLogRecGetInfo(xlogreader) & XLOG_XACT_OPMASK) != XLOG_XACT_PREPARE)

0 commit comments

Comments
 (0)