mirror of
https://github.com/postgres/postgres.git
synced 2025-08-25 20:23:07 +03:00
Simplify printing of LSNs
Add a macro LSN_FORMAT_ARGS for use in printf-style printing of LSNs. Convert all applicable code to use it. Reviewed-by: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://www.postgresql.org/message-id/flat/CAExHW5ub5NaTELZ3hJUCE6amuvqAtsSxc7O+uK7y4t9Rrk23cw@mail.gmail.com
This commit is contained in:
@@ -997,8 +997,7 @@ logical_rewrite_log_mapping(RewriteState state, TransactionId xid,
|
||||
snprintf(path, MAXPGPATH,
|
||||
"pg_logical/mappings/" LOGICAL_REWRITE_FORMAT,
|
||||
dboid, relid,
|
||||
(uint32) (state->rs_begin_lsn >> 32),
|
||||
(uint32) state->rs_begin_lsn,
|
||||
LSN_FORMAT_ARGS(state->rs_begin_lsn),
|
||||
xid, GetCurrentTransactionId());
|
||||
|
||||
dlist_init(&src->mappings);
|
||||
@@ -1120,8 +1119,7 @@ heap_xlog_logical_rewrite(XLogReaderState *r)
|
||||
snprintf(path, MAXPGPATH,
|
||||
"pg_logical/mappings/" LOGICAL_REWRITE_FORMAT,
|
||||
xlrec->mapped_db, xlrec->mapped_rel,
|
||||
(uint32) (xlrec->start_lsn >> 32),
|
||||
(uint32) xlrec->start_lsn,
|
||||
LSN_FORMAT_ARGS(xlrec->start_lsn),
|
||||
xlrec->mapped_xid, XLogRecGetXid(r));
|
||||
|
||||
fd = OpenTransientFile(path,
|
||||
|
@@ -31,8 +31,7 @@ replorigin_desc(StringInfo buf, XLogReaderState *record)
|
||||
|
||||
appendStringInfo(buf, "set %u; lsn %X/%X; force: %d",
|
||||
xlrec->node_id,
|
||||
(uint32) (xlrec->remote_lsn >> 32),
|
||||
(uint32) xlrec->remote_lsn,
|
||||
LSN_FORMAT_ARGS(xlrec->remote_lsn),
|
||||
xlrec->force);
|
||||
break;
|
||||
}
|
||||
|
@@ -306,8 +306,7 @@ xact_desc_commit(StringInfo buf, uint8 info, xl_xact_commit *xlrec, RepOriginId
|
||||
{
|
||||
appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s",
|
||||
origin_id,
|
||||
(uint32) (parsed.origin_lsn >> 32),
|
||||
(uint32) parsed.origin_lsn,
|
||||
LSN_FORMAT_ARGS(parsed.origin_lsn),
|
||||
timestamptz_to_str(parsed.origin_timestamp));
|
||||
}
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
|
||||
"oldest xid %u in DB %u; oldest multi %u in DB %u; "
|
||||
"oldest/newest commit timestamp xid: %u/%u; "
|
||||
"oldest running xid %u; %s",
|
||||
(uint32) (checkpoint->redo >> 32), (uint32) checkpoint->redo,
|
||||
LSN_FORMAT_ARGS(checkpoint->redo),
|
||||
checkpoint->ThisTimeLineID,
|
||||
checkpoint->PrevTimeLineID,
|
||||
checkpoint->fullPageWrites ? "true" : "false",
|
||||
@@ -89,8 +89,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
|
||||
XLogRecPtr startpoint;
|
||||
|
||||
memcpy(&startpoint, rec, sizeof(XLogRecPtr));
|
||||
appendStringInfo(buf, "%X/%X",
|
||||
(uint32) (startpoint >> 32), (uint32) startpoint);
|
||||
appendStringInfo(buf, "%X/%X", LSN_FORMAT_ARGS(startpoint));
|
||||
}
|
||||
else if (info == XLOG_PARAMETER_CHANGE)
|
||||
{
|
||||
|
@@ -402,7 +402,7 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI,
|
||||
"%s%u\t%X/%X\t%s\n",
|
||||
(srcfd < 0) ? "" : "\n",
|
||||
parentTLI,
|
||||
(uint32) (switchpoint >> 32), (uint32) (switchpoint),
|
||||
LSN_FORMAT_ARGS(switchpoint),
|
||||
reason);
|
||||
|
||||
nbytes = strlen(buffer);
|
||||
|
@@ -1342,16 +1342,14 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not read two-phase state from WAL at %X/%X",
|
||||
(uint32) (lsn >> 32),
|
||||
(uint32) lsn)));
|
||||
LSN_FORMAT_ARGS(lsn))));
|
||||
|
||||
if (XLogRecGetRmid(xlogreader) != RM_XACT_ID ||
|
||||
(XLogRecGetInfo(xlogreader) & XLOG_XACT_OPMASK) != XLOG_XACT_PREPARE)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("expected two-phase state data is not present in WAL at %X/%X",
|
||||
(uint32) (lsn >> 32),
|
||||
(uint32) lsn)));
|
||||
LSN_FORMAT_ARGS(lsn))));
|
||||
|
||||
if (len != NULL)
|
||||
*len = XLogRecGetDataLen(xlogreader);
|
||||
|
@@ -1219,8 +1219,7 @@ XLogInsertRecord(XLogRecData *rdata,
|
||||
oldCxt = MemoryContextSwitchTo(walDebugCxt);
|
||||
|
||||
initStringInfo(&buf);
|
||||
appendStringInfo(&buf, "INSERT @ %X/%X: ",
|
||||
(uint32) (EndPos >> 32), (uint32) EndPos);
|
||||
appendStringInfo(&buf, "INSERT @ %X/%X: ", LSN_FORMAT_ARGS(EndPos));
|
||||
|
||||
/*
|
||||
* We have to piece together the WAL record data from the XLogRecData
|
||||
@@ -1821,8 +1820,7 @@ WaitXLogInsertionsToFinish(XLogRecPtr upto)
|
||||
{
|
||||
ereport(LOG,
|
||||
(errmsg("request to flush past end of generated WAL; request %X/%X, current position %X/%X",
|
||||
(uint32) (upto >> 32), (uint32) upto,
|
||||
(uint32) (reservedUpto >> 32), (uint32) reservedUpto)));
|
||||
LSN_FORMAT_ARGS(upto), LSN_FORMAT_ARGS(reservedUpto))));
|
||||
upto = reservedUpto;
|
||||
}
|
||||
|
||||
@@ -1973,7 +1971,7 @@ GetXLogBuffer(XLogRecPtr ptr)
|
||||
|
||||
if (expectedEndPtr != endptr)
|
||||
elog(PANIC, "could not find WAL buffer for %X/%X",
|
||||
(uint32) (ptr >> 32), (uint32) ptr);
|
||||
LSN_FORMAT_ARGS(ptr));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2290,7 +2288,7 @@ AdvanceXLInsertBuffer(XLogRecPtr upto, bool opportunistic)
|
||||
if (XLOG_DEBUG && npages > 0)
|
||||
{
|
||||
elog(DEBUG1, "initialized %d pages, up to %X/%X",
|
||||
npages, (uint32) (NewPageEndPtr >> 32), (uint32) NewPageEndPtr);
|
||||
npages, LSN_FORMAT_ARGS(NewPageEndPtr));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -2471,9 +2469,8 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible)
|
||||
|
||||
if (LogwrtResult.Write >= EndPtr)
|
||||
elog(PANIC, "xlog write request %X/%X is past end of log %X/%X",
|
||||
(uint32) (LogwrtResult.Write >> 32),
|
||||
(uint32) LogwrtResult.Write,
|
||||
(uint32) (EndPtr >> 32), (uint32) EndPtr);
|
||||
LSN_FORMAT_ARGS(LogwrtResult.Write),
|
||||
LSN_FORMAT_ARGS(EndPtr));
|
||||
|
||||
/* Advance LogwrtResult.Write to end of current buffer page */
|
||||
LogwrtResult.Write = EndPtr;
|
||||
@@ -2823,9 +2820,7 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
|
||||
if (!force && newMinRecoveryPoint < lsn)
|
||||
elog(WARNING,
|
||||
"xlog min recovery request %X/%X is past current point %X/%X",
|
||||
(uint32) (lsn >> 32), (uint32) lsn,
|
||||
(uint32) (newMinRecoveryPoint >> 32),
|
||||
(uint32) newMinRecoveryPoint);
|
||||
LSN_FORMAT_ARGS(lsn), LSN_FORMAT_ARGS(newMinRecoveryPoint));
|
||||
|
||||
/* update control file */
|
||||
if (ControlFile->minRecoveryPoint < newMinRecoveryPoint)
|
||||
@@ -2838,8 +2833,7 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
|
||||
|
||||
ereport(DEBUG2,
|
||||
(errmsg_internal("updated min recovery point to %X/%X on timeline %u",
|
||||
(uint32) (minRecoveryPoint >> 32),
|
||||
(uint32) minRecoveryPoint,
|
||||
LSN_FORMAT_ARGS(minRecoveryPoint),
|
||||
newMinRecoveryPointTLI)));
|
||||
}
|
||||
}
|
||||
@@ -2878,9 +2872,9 @@ XLogFlush(XLogRecPtr record)
|
||||
#ifdef WAL_DEBUG
|
||||
if (XLOG_DEBUG)
|
||||
elog(LOG, "xlog flush request %X/%X; write %X/%X; flush %X/%X",
|
||||
(uint32) (record >> 32), (uint32) record,
|
||||
(uint32) (LogwrtResult.Write >> 32), (uint32) LogwrtResult.Write,
|
||||
(uint32) (LogwrtResult.Flush >> 32), (uint32) LogwrtResult.Flush);
|
||||
LSN_FORMAT_ARGS(record),
|
||||
LSN_FORMAT_ARGS(LogwrtResult.Write),
|
||||
LSN_FORMAT_ARGS(LogwrtResult.Flush));
|
||||
#endif
|
||||
|
||||
START_CRIT_SECTION();
|
||||
@@ -3013,8 +3007,8 @@ XLogFlush(XLogRecPtr record)
|
||||
if (LogwrtResult.Flush < record)
|
||||
elog(ERROR,
|
||||
"xlog flush request %X/%X is not satisfied --- flushed only to %X/%X",
|
||||
(uint32) (record >> 32), (uint32) record,
|
||||
(uint32) (LogwrtResult.Flush >> 32), (uint32) LogwrtResult.Flush);
|
||||
LSN_FORMAT_ARGS(record),
|
||||
LSN_FORMAT_ARGS(LogwrtResult.Flush));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3129,10 +3123,10 @@ XLogBackgroundFlush(void)
|
||||
#ifdef WAL_DEBUG
|
||||
if (XLOG_DEBUG)
|
||||
elog(LOG, "xlog bg flush request write %X/%X; flush: %X/%X, current is write %X/%X; flush %X/%X",
|
||||
(uint32) (WriteRqst.Write >> 32), (uint32) WriteRqst.Write,
|
||||
(uint32) (WriteRqst.Flush >> 32), (uint32) WriteRqst.Flush,
|
||||
(uint32) (LogwrtResult.Write >> 32), (uint32) LogwrtResult.Write,
|
||||
(uint32) (LogwrtResult.Flush >> 32), (uint32) LogwrtResult.Flush);
|
||||
LSN_FORMAT_ARGS(WriteRqst.Write),
|
||||
LSN_FORMAT_ARGS(WriteRqst.Flush),
|
||||
LSN_FORMAT_ARGS(LogwrtResult.Write),
|
||||
LSN_FORMAT_ARGS(LogwrtResult.Flush));
|
||||
#endif
|
||||
|
||||
START_CRIT_SECTION();
|
||||
@@ -4560,7 +4554,7 @@ rescanLatestTimeLine(void)
|
||||
(errmsg("new timeline %u forked off current database system timeline %u before current recovery point %X/%X",
|
||||
newtarget,
|
||||
ThisTimeLineID,
|
||||
(uint32) (EndRecPtr >> 32), (uint32) EndRecPtr)));
|
||||
LSN_FORMAT_ARGS(EndRecPtr))));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5754,8 +5748,7 @@ recoveryStopsBefore(XLogReaderState *record)
|
||||
recoveryStopName[0] = '\0';
|
||||
ereport(LOG,
|
||||
(errmsg("recovery stopping before WAL location (LSN) \"%X/%X\"",
|
||||
(uint32) (recoveryStopLSN >> 32),
|
||||
(uint32) recoveryStopLSN)));
|
||||
LSN_FORMAT_ARGS(recoveryStopLSN))));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5918,8 +5911,7 @@ recoveryStopsAfter(XLogReaderState *record)
|
||||
recoveryStopName[0] = '\0';
|
||||
ereport(LOG,
|
||||
(errmsg("recovery stopping after WAL location (LSN) \"%X/%X\"",
|
||||
(uint32) (recoveryStopLSN >> 32),
|
||||
(uint32) recoveryStopLSN)));
|
||||
LSN_FORMAT_ARGS(recoveryStopLSN))));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6531,8 +6523,7 @@ StartupXLOG(void)
|
||||
else if (recoveryTarget == RECOVERY_TARGET_LSN)
|
||||
ereport(LOG,
|
||||
(errmsg("starting point-in-time recovery to WAL location (LSN) \"%X/%X\"",
|
||||
(uint32) (recoveryTargetLSN >> 32),
|
||||
(uint32) recoveryTargetLSN)));
|
||||
LSN_FORMAT_ARGS(recoveryTargetLSN))));
|
||||
else if (recoveryTarget == RECOVERY_TARGET_IMMEDIATE)
|
||||
ereport(LOG,
|
||||
(errmsg("starting point-in-time recovery to earliest consistent point")));
|
||||
@@ -6598,7 +6589,7 @@ StartupXLOG(void)
|
||||
wasShutdown = ((record->xl_info & ~XLR_INFO_MASK) == XLOG_CHECKPOINT_SHUTDOWN);
|
||||
ereport(DEBUG1,
|
||||
(errmsg_internal("checkpoint record is at %X/%X",
|
||||
(uint32) (checkPointLoc >> 32), (uint32) checkPointLoc)));
|
||||
LSN_FORMAT_ARGS(checkPointLoc))));
|
||||
InRecovery = true; /* force recovery even if SHUTDOWNED */
|
||||
|
||||
/*
|
||||
@@ -6731,7 +6722,7 @@ StartupXLOG(void)
|
||||
{
|
||||
ereport(DEBUG1,
|
||||
(errmsg_internal("checkpoint record is at %X/%X",
|
||||
(uint32) (checkPointLoc >> 32), (uint32) checkPointLoc)));
|
||||
LSN_FORMAT_ARGS(checkPointLoc))));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6783,11 +6774,9 @@ StartupXLOG(void)
|
||||
(errmsg("requested timeline %u is not a child of this server's history",
|
||||
recoveryTargetTLI),
|
||||
errdetail("Latest checkpoint is at %X/%X on timeline %u, but in the history of the requested timeline, the server forked off from that timeline at %X/%X.",
|
||||
(uint32) (ControlFile->checkPoint >> 32),
|
||||
(uint32) ControlFile->checkPoint,
|
||||
LSN_FORMAT_ARGS(ControlFile->checkPoint),
|
||||
ControlFile->checkPointCopy.ThisTimeLineID,
|
||||
(uint32) (switchpoint >> 32),
|
||||
(uint32) switchpoint)));
|
||||
LSN_FORMAT_ARGS(switchpoint))));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -6800,15 +6789,14 @@ StartupXLOG(void)
|
||||
ereport(FATAL,
|
||||
(errmsg("requested timeline %u does not contain minimum recovery point %X/%X on timeline %u",
|
||||
recoveryTargetTLI,
|
||||
(uint32) (ControlFile->minRecoveryPoint >> 32),
|
||||
(uint32) ControlFile->minRecoveryPoint,
|
||||
LSN_FORMAT_ARGS(ControlFile->minRecoveryPoint),
|
||||
ControlFile->minRecoveryPointTLI)));
|
||||
|
||||
LastRec = RecPtr = checkPointLoc;
|
||||
|
||||
ereport(DEBUG1,
|
||||
(errmsg_internal("redo record is at %X/%X; shutdown %s",
|
||||
(uint32) (checkPoint.redo >> 32), (uint32) checkPoint.redo,
|
||||
LSN_FORMAT_ARGS(checkPoint.redo),
|
||||
wasShutdown ? "true" : "false")));
|
||||
ereport(DEBUG1,
|
||||
(errmsg_internal("next transaction ID: " UINT64_FORMAT "; next OID: %u",
|
||||
@@ -7254,7 +7242,7 @@ StartupXLOG(void)
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg("redo starts at %X/%X",
|
||||
(uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr)));
|
||||
LSN_FORMAT_ARGS(ReadRecPtr))));
|
||||
|
||||
/*
|
||||
* main redo apply loop
|
||||
@@ -7272,8 +7260,8 @@ StartupXLOG(void)
|
||||
|
||||
initStringInfo(&buf);
|
||||
appendStringInfo(&buf, "REDO @ %X/%X; LSN %X/%X: ",
|
||||
(uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr,
|
||||
(uint32) (EndRecPtr >> 32), (uint32) EndRecPtr);
|
||||
LSN_FORMAT_ARGS(ReadRecPtr),
|
||||
LSN_FORMAT_ARGS(EndRecPtr));
|
||||
xlog_outrec(&buf, xlogreader);
|
||||
appendStringInfoString(&buf, " - ");
|
||||
xlog_outdesc(&buf, xlogreader);
|
||||
@@ -7516,7 +7504,7 @@ StartupXLOG(void)
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg("redo done at %X/%X system usage: %s",
|
||||
(uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr,
|
||||
LSN_FORMAT_ARGS(ReadRecPtr),
|
||||
pg_rusage_show(&ru0))));
|
||||
xtime = GetLatestXTime();
|
||||
if (xtime)
|
||||
@@ -7684,8 +7672,7 @@ StartupXLOG(void)
|
||||
snprintf(reason, sizeof(reason),
|
||||
"%s LSN %X/%X\n",
|
||||
recoveryStopAfter ? "after" : "before",
|
||||
(uint32) (recoveryStopLSN >> 32),
|
||||
(uint32) recoveryStopLSN);
|
||||
LSN_FORMAT_ARGS(recoveryStopLSN));
|
||||
else if (recoveryTarget == RECOVERY_TARGET_NAME)
|
||||
snprintf(reason, sizeof(reason),
|
||||
"at restore point \"%s\"",
|
||||
@@ -8109,8 +8096,7 @@ CheckRecoveryConsistency(void)
|
||||
reachedConsistency = true;
|
||||
ereport(LOG,
|
||||
(errmsg("consistent recovery state reached at %X/%X",
|
||||
(uint32) (lastReplayedEndRecPtr >> 32),
|
||||
(uint32) lastReplayedEndRecPtr)));
|
||||
LSN_FORMAT_ARGS(lastReplayedEndRecPtr))));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -9344,8 +9330,7 @@ RecoveryRestartPoint(const CheckPoint *checkPoint)
|
||||
elog(trace_recovery(DEBUG2),
|
||||
"could not record restart point at %X/%X because there "
|
||||
"are unresolved references to invalid pages",
|
||||
(uint32) (checkPoint->redo >> 32),
|
||||
(uint32) checkPoint->redo);
|
||||
LSN_FORMAT_ARGS(checkPoint->redo));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -9422,8 +9407,7 @@ CreateRestartPoint(int flags)
|
||||
{
|
||||
ereport(DEBUG2,
|
||||
(errmsg_internal("skipping restartpoint, already performed at %X/%X",
|
||||
(uint32) (lastCheckPoint.redo >> 32),
|
||||
(uint32) lastCheckPoint.redo)));
|
||||
LSN_FORMAT_ARGS(lastCheckPoint.redo))));
|
||||
|
||||
UpdateMinRecoveryPoint(InvalidXLogRecPtr, true);
|
||||
if (flags & CHECKPOINT_IS_SHUTDOWN)
|
||||
@@ -9595,7 +9579,7 @@ CreateRestartPoint(int flags)
|
||||
xtime = GetLatestXTime();
|
||||
ereport((log_checkpoints ? LOG : DEBUG2),
|
||||
(errmsg("recovery restart point at %X/%X",
|
||||
(uint32) (lastCheckPoint.redo >> 32), (uint32) lastCheckPoint.redo),
|
||||
LSN_FORMAT_ARGS(lastCheckPoint.redo)),
|
||||
xtime ? errdetail("Last completed transaction was at log time %s.",
|
||||
timestamptz_to_str(xtime)) : 0));
|
||||
|
||||
@@ -9837,7 +9821,7 @@ XLogRestorePoint(const char *rpName)
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg("restore point \"%s\" created at %X/%X",
|
||||
rpName, (uint32) (RecPtr >> 32), (uint32) RecPtr)));
|
||||
rpName, LSN_FORMAT_ARGS(RecPtr))));
|
||||
|
||||
return RecPtr;
|
||||
}
|
||||
@@ -10008,8 +9992,7 @@ checkTimeLineSwitch(XLogRecPtr lsn, TimeLineID newTLI, TimeLineID prevTLI)
|
||||
ereport(PANIC,
|
||||
(errmsg("unexpected timeline ID %u in checkpoint record, before reaching minimum recovery point %X/%X on timeline %u",
|
||||
newTLI,
|
||||
(uint32) (minRecoveryPoint >> 32),
|
||||
(uint32) minRecoveryPoint,
|
||||
LSN_FORMAT_ARGS(minRecoveryPoint),
|
||||
minRecoveryPointTLI)));
|
||||
|
||||
/* Looks good */
|
||||
@@ -10365,8 +10348,7 @@ static void
|
||||
xlog_outrec(StringInfo buf, XLogReaderState *record)
|
||||
{
|
||||
appendStringInfo(buf, "prev %X/%X; xid %u",
|
||||
(uint32) (XLogRecGetPrev(record) >> 32),
|
||||
(uint32) XLogRecGetPrev(record),
|
||||
LSN_FORMAT_ARGS(XLogRecGetPrev(record)),
|
||||
XLogRecGetXid(record));
|
||||
|
||||
appendStringInfo(buf, "; len %u",
|
||||
@@ -10952,9 +10934,9 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
|
||||
"%Y-%m-%d %H:%M:%S %Z",
|
||||
pg_localtime(&stamp_time, log_timezone));
|
||||
appendStringInfo(labelfile, "START WAL LOCATION: %X/%X (file %s)\n",
|
||||
(uint32) (startpoint >> 32), (uint32) startpoint, xlogfilename);
|
||||
LSN_FORMAT_ARGS(startpoint), xlogfilename);
|
||||
appendStringInfo(labelfile, "CHECKPOINT LOCATION: %X/%X\n",
|
||||
(uint32) (checkpointloc >> 32), (uint32) checkpointloc);
|
||||
LSN_FORMAT_ARGS(checkpointloc));
|
||||
appendStringInfo(labelfile, "BACKUP METHOD: %s\n",
|
||||
exclusive ? "pg_start_backup" : "streamed");
|
||||
appendStringInfo(labelfile, "BACKUP FROM: %s\n",
|
||||
@@ -11440,9 +11422,9 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p)
|
||||
errmsg("could not create file \"%s\": %m",
|
||||
histfilepath)));
|
||||
fprintf(fp, "START WAL LOCATION: %X/%X (file %s)\n",
|
||||
(uint32) (startpoint >> 32), (uint32) startpoint, startxlogfilename);
|
||||
LSN_FORMAT_ARGS(startpoint), startxlogfilename);
|
||||
fprintf(fp, "STOP WAL LOCATION: %X/%X (file %s)\n",
|
||||
(uint32) (stoppoint >> 32), (uint32) stoppoint, stopxlogfilename);
|
||||
LSN_FORMAT_ARGS(stoppoint), stopxlogfilename);
|
||||
|
||||
/*
|
||||
* Transfer remaining lines including label and start timeline to
|
||||
@@ -11895,8 +11877,7 @@ rm_redo_error_callback(void *arg)
|
||||
|
||||
/* translator: %s is a WAL record description */
|
||||
errcontext("WAL redo at %X/%X for %s",
|
||||
(uint32) (record->ReadRecPtr >> 32),
|
||||
(uint32) record->ReadRecPtr,
|
||||
LSN_FORMAT_ARGS(record->ReadRecPtr),
|
||||
buf.data);
|
||||
|
||||
pfree(buf.data);
|
||||
@@ -12494,8 +12475,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
|
||||
|
||||
if (curFileTLI > 0 && tli < curFileTLI)
|
||||
elog(ERROR, "according to history file, WAL location %X/%X belongs to timeline %u, but previous recovered WAL file came from timeline %u",
|
||||
(uint32) (tliRecPtr >> 32),
|
||||
(uint32) tliRecPtr,
|
||||
LSN_FORMAT_ARGS(tliRecPtr),
|
||||
tli, curFileTLI);
|
||||
}
|
||||
curFileTLI = tli;
|
||||
|
@@ -347,7 +347,7 @@ XLogReadRecord(XLogReaderState *state, char **errormsg)
|
||||
else if (targetRecOff < pageHeaderSize)
|
||||
{
|
||||
report_invalid_record(state, "invalid record offset at %X/%X",
|
||||
(uint32) (RecPtr >> 32), (uint32) RecPtr);
|
||||
LSN_FORMAT_ARGS(RecPtr));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ XLogReadRecord(XLogReaderState *state, char **errormsg)
|
||||
targetRecOff == pageHeaderSize)
|
||||
{
|
||||
report_invalid_record(state, "contrecord is requested by %X/%X",
|
||||
(uint32) (RecPtr >> 32), (uint32) RecPtr);
|
||||
LSN_FORMAT_ARGS(RecPtr));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ XLogReadRecord(XLogReaderState *state, char **errormsg)
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"invalid record length at %X/%X: wanted %u, got %u",
|
||||
(uint32) (RecPtr >> 32), (uint32) RecPtr,
|
||||
LSN_FORMAT_ARGS(RecPtr),
|
||||
(uint32) SizeOfXLogRecord, total_len);
|
||||
goto err;
|
||||
}
|
||||
@@ -420,8 +420,7 @@ XLogReadRecord(XLogReaderState *state, char **errormsg)
|
||||
{
|
||||
/* We treat this as a "bogus data" condition */
|
||||
report_invalid_record(state, "record length %u at %X/%X too long",
|
||||
total_len,
|
||||
(uint32) (RecPtr >> 32), (uint32) RecPtr);
|
||||
total_len, LSN_FORMAT_ARGS(RecPtr));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -452,7 +451,7 @@ XLogReadRecord(XLogReaderState *state, char **errormsg)
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"there is no contrecord flag at %X/%X",
|
||||
(uint32) (RecPtr >> 32), (uint32) RecPtr);
|
||||
LSN_FORMAT_ARGS(RecPtr));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -467,7 +466,7 @@ XLogReadRecord(XLogReaderState *state, char **errormsg)
|
||||
"invalid contrecord length %u (expected %lld) at %X/%X",
|
||||
pageHeader->xlp_rem_len,
|
||||
((long long) total_len) - gotlen,
|
||||
(uint32) (RecPtr >> 32), (uint32) RecPtr);
|
||||
LSN_FORMAT_ARGS(RecPtr));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -694,7 +693,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"invalid record length at %X/%X: wanted %u, got %u",
|
||||
(uint32) (RecPtr >> 32), (uint32) RecPtr,
|
||||
LSN_FORMAT_ARGS(RecPtr),
|
||||
(uint32) SizeOfXLogRecord, record->xl_tot_len);
|
||||
return false;
|
||||
}
|
||||
@@ -702,8 +701,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"invalid resource manager ID %u at %X/%X",
|
||||
record->xl_rmid, (uint32) (RecPtr >> 32),
|
||||
(uint32) RecPtr);
|
||||
record->xl_rmid, LSN_FORMAT_ARGS(RecPtr));
|
||||
return false;
|
||||
}
|
||||
if (randAccess)
|
||||
@@ -716,9 +714,8 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"record with incorrect prev-link %X/%X at %X/%X",
|
||||
(uint32) (record->xl_prev >> 32),
|
||||
(uint32) record->xl_prev,
|
||||
(uint32) (RecPtr >> 32), (uint32) RecPtr);
|
||||
LSN_FORMAT_ARGS(record->xl_prev),
|
||||
LSN_FORMAT_ARGS(RecPtr));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -733,9 +730,8 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"record with incorrect prev-link %X/%X at %X/%X",
|
||||
(uint32) (record->xl_prev >> 32),
|
||||
(uint32) record->xl_prev,
|
||||
(uint32) (RecPtr >> 32), (uint32) RecPtr);
|
||||
LSN_FORMAT_ARGS(record->xl_prev),
|
||||
LSN_FORMAT_ARGS(RecPtr));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -770,7 +766,7 @@ ValidXLogRecord(XLogReaderState *state, XLogRecord *record, XLogRecPtr recptr)
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"incorrect resource manager data checksum in record at %X/%X",
|
||||
(uint32) (recptr >> 32), (uint32) recptr);
|
||||
LSN_FORMAT_ARGS(recptr));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -881,7 +877,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
|
||||
|
||||
report_invalid_record(state,
|
||||
"unexpected pageaddr %X/%X in log segment %s, offset %u",
|
||||
(uint32) (hdr->xlp_pageaddr >> 32), (uint32) hdr->xlp_pageaddr,
|
||||
LSN_FORMAT_ARGS(hdr->xlp_pageaddr),
|
||||
fname,
|
||||
offset);
|
||||
return false;
|
||||
@@ -1252,8 +1248,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
|
||||
report_invalid_record(state,
|
||||
"out-of-order block_id %u at %X/%X",
|
||||
block_id,
|
||||
(uint32) (state->ReadRecPtr >> 32),
|
||||
(uint32) state->ReadRecPtr);
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
}
|
||||
state->max_block_id = block_id;
|
||||
@@ -1274,7 +1269,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"BKPBLOCK_HAS_DATA set, but no data included at %X/%X",
|
||||
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr);
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
}
|
||||
if (!blk->has_data && blk->data_len != 0)
|
||||
@@ -1282,7 +1277,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
|
||||
report_invalid_record(state,
|
||||
"BKPBLOCK_HAS_DATA not set, but data length is %u at %X/%X",
|
||||
(unsigned int) blk->data_len,
|
||||
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr);
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
}
|
||||
datatotal += blk->data_len;
|
||||
@@ -1320,7 +1315,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
|
||||
(unsigned int) blk->hole_offset,
|
||||
(unsigned int) blk->hole_length,
|
||||
(unsigned int) blk->bimg_len,
|
||||
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr);
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1335,7 +1330,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
|
||||
"BKPIMAGE_HAS_HOLE not set, but hole offset %u length %u at %X/%X",
|
||||
(unsigned int) blk->hole_offset,
|
||||
(unsigned int) blk->hole_length,
|
||||
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr);
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1349,7 +1344,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
|
||||
report_invalid_record(state,
|
||||
"BKPIMAGE_IS_COMPRESSED set, but block image length %u at %X/%X",
|
||||
(unsigned int) blk->bimg_len,
|
||||
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr);
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1364,7 +1359,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
|
||||
report_invalid_record(state,
|
||||
"neither BKPIMAGE_HAS_HOLE nor BKPIMAGE_IS_COMPRESSED set, but block image length is %u at %X/%X",
|
||||
(unsigned int) blk->data_len,
|
||||
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr);
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -1379,7 +1374,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"BKPBLOCK_SAME_REL set but no previous rel at %X/%X",
|
||||
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr);
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1391,9 +1386,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"invalid block_id %u at %X/%X",
|
||||
block_id,
|
||||
(uint32) (state->ReadRecPtr >> 32),
|
||||
(uint32) state->ReadRecPtr);
|
||||
block_id, LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -1480,7 +1473,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
|
||||
shortdata_err:
|
||||
report_invalid_record(state,
|
||||
"record with invalid length at %X/%X",
|
||||
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr);
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
err:
|
||||
*errormsg = state->errormsg_buf;
|
||||
|
||||
@@ -1569,8 +1562,7 @@ RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
|
||||
BLCKSZ - bkpb->hole_length, true) < 0)
|
||||
{
|
||||
report_invalid_record(record, "invalid compressed image at %X/%X, block %d",
|
||||
(uint32) (record->ReadRecPtr >> 32),
|
||||
(uint32) record->ReadRecPtr,
|
||||
LSN_FORMAT_ARGS(record->ReadRecPtr),
|
||||
block_id);
|
||||
return false;
|
||||
}
|
||||
|
@@ -776,8 +776,7 @@ XLogReadDetermineTimeline(XLogReaderState *state, XLogRecPtr wantPage, uint32 wa
|
||||
|
||||
elog(DEBUG3, "switched to timeline %u valid until %X/%X",
|
||||
state->currTLI,
|
||||
(uint32) (state->currTLIValidUntil >> 32),
|
||||
(uint32) (state->currTLIValidUntil));
|
||||
LSN_FORMAT_ARGS(state->currTLIValidUntil));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user