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:
Peter Eisentraut 2021-02-23 10:14:38 +01:00
parent ade89ba5f4
commit 6f6f284c7e
36 changed files with 212 additions and 308 deletions

View File

@ -1078,8 +1078,7 @@ bt_target_page_check(BtreeCheckState *state)
state->targetblock, state->targetblock,
BTreeTupleGetNAtts(itup, state->rel), BTreeTupleGetNAtts(itup, state->rel),
P_ISLEAF(topaque) ? "heap" : "index", P_ISLEAF(topaque) ? "heap" : "index",
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
} }
} }
@ -1120,8 +1119,7 @@ bt_target_page_check(BtreeCheckState *state)
errdetail_internal("Index tid=(%u,%u) tuple size=%zu lp_len=%u page lsn=%X/%X.", errdetail_internal("Index tid=(%u,%u) tuple size=%zu lp_len=%u page lsn=%X/%X.",
state->targetblock, offset, state->targetblock, offset,
tupsize, ItemIdGetLength(itemid), tupsize, ItemIdGetLength(itemid),
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn)),
(uint32) state->targetlsn),
errhint("This could be a torn page problem."))); errhint("This could be a torn page problem.")));
/* Check the number of index tuple attributes */ /* Check the number of index tuple attributes */
@ -1147,8 +1145,7 @@ bt_target_page_check(BtreeCheckState *state)
BTreeTupleGetNAtts(itup, state->rel), BTreeTupleGetNAtts(itup, state->rel),
P_ISLEAF(topaque) ? "heap" : "index", P_ISLEAF(topaque) ? "heap" : "index",
htid, htid,
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
} }
/* /*
@ -1195,8 +1192,7 @@ bt_target_page_check(BtreeCheckState *state)
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Index tid=%s points to heap tid=%s page lsn=%X/%X.", errdetail_internal("Index tid=%s points to heap tid=%s page lsn=%X/%X.",
itid, htid, itid, htid,
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
} }
/* /*
@ -1225,8 +1221,7 @@ bt_target_page_check(BtreeCheckState *state)
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Index tid=%s posting list offset=%d page lsn=%X/%X.", errdetail_internal("Index tid=%s posting list offset=%d page lsn=%X/%X.",
itid, i, itid, i,
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
} }
ItemPointerCopy(current, &last); ItemPointerCopy(current, &last);
@ -1282,8 +1277,7 @@ bt_target_page_check(BtreeCheckState *state)
itid, itid,
P_ISLEAF(topaque) ? "heap" : "index", P_ISLEAF(topaque) ? "heap" : "index",
htid, htid,
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
} }
/* Fingerprint leaf page tuples (those that point to the heap) */ /* Fingerprint leaf page tuples (those that point to the heap) */
@ -1390,8 +1384,7 @@ bt_target_page_check(BtreeCheckState *state)
itid, itid,
P_ISLEAF(topaque) ? "heap" : "index", P_ISLEAF(topaque) ? "heap" : "index",
htid, htid,
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
} }
/* Reset, in case scantid was set to (itup) posting tuple's max TID */ /* Reset, in case scantid was set to (itup) posting tuple's max TID */
skey->scantid = scantid; skey->scantid = scantid;
@ -1442,8 +1435,7 @@ bt_target_page_check(BtreeCheckState *state)
nitid, nitid,
P_ISLEAF(topaque) ? "heap" : "index", P_ISLEAF(topaque) ? "heap" : "index",
nhtid, nhtid,
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
} }
/* /*
@ -1500,8 +1492,7 @@ bt_target_page_check(BtreeCheckState *state)
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Last item on page tid=(%u,%u) page lsn=%X/%X.", errdetail_internal("Last item on page tid=(%u,%u) page lsn=%X/%X.",
state->targetblock, offset, state->targetblock, offset,
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
} }
} }
@ -1907,8 +1898,7 @@ bt_child_highkey_check(BtreeCheckState *state,
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.", errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.",
state->targetblock, blkno, state->targetblock, blkno,
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
/* Check level for non-ignorable page */ /* Check level for non-ignorable page */
if (!P_IGNORE(opaque) && opaque->btpo.level != target_level - 1) if (!P_IGNORE(opaque) && opaque->btpo.level != target_level - 1)
@ -1993,8 +1983,7 @@ bt_child_highkey_check(BtreeCheckState *state,
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.", errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.",
state->targetblock, blkno, state->targetblock, blkno,
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
pivotkey_offset = P_HIKEY; pivotkey_offset = P_HIKEY;
} }
itemid = PageGetItemIdCareful(state, state->targetblock, itemid = PageGetItemIdCareful(state, state->targetblock,
@ -2024,8 +2013,7 @@ bt_child_highkey_check(BtreeCheckState *state,
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.", errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.",
state->targetblock, blkno, state->targetblock, blkno,
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
itup = state->lowkey; itup = state->lowkey;
} }
@ -2037,8 +2025,7 @@ bt_child_highkey_check(BtreeCheckState *state,
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.", errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.",
state->targetblock, blkno, state->targetblock, blkno,
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
} }
} }
@ -2178,8 +2165,7 @@ bt_child_check(BtreeCheckState *state, BTScanInsert targetkey,
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Parent block=%u child block=%u parent page lsn=%X/%X.", errdetail_internal("Parent block=%u child block=%u parent page lsn=%X/%X.",
state->targetblock, childblock, state->targetblock, childblock,
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
for (offset = P_FIRSTDATAKEY(copaque); for (offset = P_FIRSTDATAKEY(copaque);
offset <= maxoffset; offset <= maxoffset;
@ -2220,8 +2206,7 @@ bt_child_check(BtreeCheckState *state, BTScanInsert targetkey,
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Parent block=%u child index tid=(%u,%u) parent page lsn=%X/%X.", errdetail_internal("Parent block=%u child index tid=(%u,%u) parent page lsn=%X/%X.",
state->targetblock, childblock, offset, state->targetblock, childblock, offset,
(uint32) (state->targetlsn >> 32), LSN_FORMAT_ARGS(state->targetlsn))));
(uint32) state->targetlsn)));
} }
pfree(child); pfree(child);
@ -2292,8 +2277,7 @@ bt_downlink_missing_check(BtreeCheckState *state, bool rightsplit,
errdetail_internal("Block=%u level=%u left sibling=%u page lsn=%X/%X.", errdetail_internal("Block=%u level=%u left sibling=%u page lsn=%X/%X.",
blkno, opaque->btpo.level, blkno, opaque->btpo.level,
opaque->btpo_prev, opaque->btpo_prev,
(uint32) (pagelsn >> 32), LSN_FORMAT_ARGS(pagelsn))));
(uint32) pagelsn)));
return; return;
} }
@ -2314,8 +2298,7 @@ bt_downlink_missing_check(BtreeCheckState *state, bool rightsplit,
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Block=%u page lsn=%X/%X.", errdetail_internal("Block=%u page lsn=%X/%X.",
blkno, blkno,
(uint32) (pagelsn >> 32), LSN_FORMAT_ARGS(pagelsn))));
(uint32) pagelsn)));
/* Descend from the given page, which is an internal page */ /* Descend from the given page, which is an internal page */
elog(DEBUG1, "checking for interrupted multi-level deletion due to missing downlink in index \"%s\"", elog(DEBUG1, "checking for interrupted multi-level deletion due to missing downlink in index \"%s\"",
@ -2381,8 +2364,7 @@ bt_downlink_missing_check(BtreeCheckState *state, bool rightsplit,
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Top parent/target block=%u leaf block=%u top parent/under check lsn=%X/%X.", errdetail_internal("Top parent/target block=%u leaf block=%u top parent/under check lsn=%X/%X.",
blkno, childblk, blkno, childblk,
(uint32) (pagelsn >> 32), LSN_FORMAT_ARGS(pagelsn))));
(uint32) pagelsn)));
/* /*
* Iff leaf page is half-dead, its high key top parent link should point * Iff leaf page is half-dead, its high key top parent link should point
@ -2408,8 +2390,7 @@ bt_downlink_missing_check(BtreeCheckState *state, bool rightsplit,
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Block=%u level=%u page lsn=%X/%X.", errdetail_internal("Block=%u level=%u page lsn=%X/%X.",
blkno, opaque->btpo.level, blkno, opaque->btpo.level,
(uint32) (pagelsn >> 32), LSN_FORMAT_ARGS(pagelsn))));
(uint32) pagelsn)));
} }
/* /*

View File

@ -309,8 +309,7 @@ page_header(PG_FUNCTION_ARGS)
{ {
char lsnchar[64]; char lsnchar[64];
snprintf(lsnchar, sizeof(lsnchar), "%X/%X", snprintf(lsnchar, sizeof(lsnchar), "%X/%X", LSN_FORMAT_ARGS(lsn));
(uint32) (lsn >> 32), (uint32) lsn);
values[0] = CStringGetTextDatum(lsnchar); values[0] = CStringGetTextDatum(lsnchar);
} }
else else

View File

@ -997,8 +997,7 @@ logical_rewrite_log_mapping(RewriteState state, TransactionId xid,
snprintf(path, MAXPGPATH, snprintf(path, MAXPGPATH,
"pg_logical/mappings/" LOGICAL_REWRITE_FORMAT, "pg_logical/mappings/" LOGICAL_REWRITE_FORMAT,
dboid, relid, dboid, relid,
(uint32) (state->rs_begin_lsn >> 32), LSN_FORMAT_ARGS(state->rs_begin_lsn),
(uint32) state->rs_begin_lsn,
xid, GetCurrentTransactionId()); xid, GetCurrentTransactionId());
dlist_init(&src->mappings); dlist_init(&src->mappings);
@ -1120,8 +1119,7 @@ heap_xlog_logical_rewrite(XLogReaderState *r)
snprintf(path, MAXPGPATH, snprintf(path, MAXPGPATH,
"pg_logical/mappings/" LOGICAL_REWRITE_FORMAT, "pg_logical/mappings/" LOGICAL_REWRITE_FORMAT,
xlrec->mapped_db, xlrec->mapped_rel, xlrec->mapped_db, xlrec->mapped_rel,
(uint32) (xlrec->start_lsn >> 32), LSN_FORMAT_ARGS(xlrec->start_lsn),
(uint32) xlrec->start_lsn,
xlrec->mapped_xid, XLogRecGetXid(r)); xlrec->mapped_xid, XLogRecGetXid(r));
fd = OpenTransientFile(path, fd = OpenTransientFile(path,

View File

@ -31,8 +31,7 @@ replorigin_desc(StringInfo buf, XLogReaderState *record)
appendStringInfo(buf, "set %u; lsn %X/%X; force: %d", appendStringInfo(buf, "set %u; lsn %X/%X; force: %d",
xlrec->node_id, xlrec->node_id,
(uint32) (xlrec->remote_lsn >> 32), LSN_FORMAT_ARGS(xlrec->remote_lsn),
(uint32) xlrec->remote_lsn,
xlrec->force); xlrec->force);
break; break;
} }

View File

@ -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", appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s",
origin_id, origin_id,
(uint32) (parsed.origin_lsn >> 32), LSN_FORMAT_ARGS(parsed.origin_lsn),
(uint32) parsed.origin_lsn,
timestamptz_to_str(parsed.origin_timestamp)); timestamptz_to_str(parsed.origin_timestamp));
} }
} }

View File

@ -49,7 +49,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
"oldest xid %u in DB %u; oldest multi %u in DB %u; " "oldest xid %u in DB %u; oldest multi %u in DB %u; "
"oldest/newest commit timestamp xid: %u/%u; " "oldest/newest commit timestamp xid: %u/%u; "
"oldest running xid %u; %s", "oldest running xid %u; %s",
(uint32) (checkpoint->redo >> 32), (uint32) checkpoint->redo, LSN_FORMAT_ARGS(checkpoint->redo),
checkpoint->ThisTimeLineID, checkpoint->ThisTimeLineID,
checkpoint->PrevTimeLineID, checkpoint->PrevTimeLineID,
checkpoint->fullPageWrites ? "true" : "false", checkpoint->fullPageWrites ? "true" : "false",
@ -89,8 +89,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
XLogRecPtr startpoint; XLogRecPtr startpoint;
memcpy(&startpoint, rec, sizeof(XLogRecPtr)); memcpy(&startpoint, rec, sizeof(XLogRecPtr));
appendStringInfo(buf, "%X/%X", appendStringInfo(buf, "%X/%X", LSN_FORMAT_ARGS(startpoint));
(uint32) (startpoint >> 32), (uint32) startpoint);
} }
else if (info == XLOG_PARAMETER_CHANGE) else if (info == XLOG_PARAMETER_CHANGE)
{ {

View File

@ -402,7 +402,7 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI,
"%s%u\t%X/%X\t%s\n", "%s%u\t%X/%X\t%s\n",
(srcfd < 0) ? "" : "\n", (srcfd < 0) ? "" : "\n",
parentTLI, parentTLI,
(uint32) (switchpoint >> 32), (uint32) (switchpoint), LSN_FORMAT_ARGS(switchpoint),
reason); reason);
nbytes = strlen(buffer); nbytes = strlen(buffer);

View File

@ -1342,16 +1342,14 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len)
ereport(ERROR, ereport(ERROR,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("could not read two-phase state from WAL at %X/%X", errmsg("could not read two-phase state from WAL at %X/%X",
(uint32) (lsn >> 32), LSN_FORMAT_ARGS(lsn))));
(uint32) lsn)));
if (XLogRecGetRmid(xlogreader) != RM_XACT_ID || if (XLogRecGetRmid(xlogreader) != RM_XACT_ID ||
(XLogRecGetInfo(xlogreader) & XLOG_XACT_OPMASK) != XLOG_XACT_PREPARE) (XLogRecGetInfo(xlogreader) & XLOG_XACT_OPMASK) != XLOG_XACT_PREPARE)
ereport(ERROR, ereport(ERROR,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("expected two-phase state data is not present in WAL at %X/%X", errmsg("expected two-phase state data is not present in WAL at %X/%X",
(uint32) (lsn >> 32), LSN_FORMAT_ARGS(lsn))));
(uint32) lsn)));
if (len != NULL) if (len != NULL)
*len = XLogRecGetDataLen(xlogreader); *len = XLogRecGetDataLen(xlogreader);

View File

@ -1219,8 +1219,7 @@ XLogInsertRecord(XLogRecData *rdata,
oldCxt = MemoryContextSwitchTo(walDebugCxt); oldCxt = MemoryContextSwitchTo(walDebugCxt);
initStringInfo(&buf); initStringInfo(&buf);
appendStringInfo(&buf, "INSERT @ %X/%X: ", appendStringInfo(&buf, "INSERT @ %X/%X: ", LSN_FORMAT_ARGS(EndPos));
(uint32) (EndPos >> 32), (uint32) EndPos);
/* /*
* We have to piece together the WAL record data from the XLogRecData * We have to piece together the WAL record data from the XLogRecData
@ -1821,8 +1820,7 @@ WaitXLogInsertionsToFinish(XLogRecPtr upto)
{ {
ereport(LOG, ereport(LOG,
(errmsg("request to flush past end of generated WAL; request %X/%X, current position %X/%X", (errmsg("request to flush past end of generated WAL; request %X/%X, current position %X/%X",
(uint32) (upto >> 32), (uint32) upto, LSN_FORMAT_ARGS(upto), LSN_FORMAT_ARGS(reservedUpto))));
(uint32) (reservedUpto >> 32), (uint32) reservedUpto)));
upto = reservedUpto; upto = reservedUpto;
} }
@ -1973,7 +1971,7 @@ GetXLogBuffer(XLogRecPtr ptr)
if (expectedEndPtr != endptr) if (expectedEndPtr != endptr)
elog(PANIC, "could not find WAL buffer for %X/%X", elog(PANIC, "could not find WAL buffer for %X/%X",
(uint32) (ptr >> 32), (uint32) ptr); LSN_FORMAT_ARGS(ptr));
} }
else else
{ {
@ -2290,7 +2288,7 @@ AdvanceXLInsertBuffer(XLogRecPtr upto, bool opportunistic)
if (XLOG_DEBUG && npages > 0) if (XLOG_DEBUG && npages > 0)
{ {
elog(DEBUG1, "initialized %d pages, up to %X/%X", elog(DEBUG1, "initialized %d pages, up to %X/%X",
npages, (uint32) (NewPageEndPtr >> 32), (uint32) NewPageEndPtr); npages, LSN_FORMAT_ARGS(NewPageEndPtr));
} }
#endif #endif
} }
@ -2471,9 +2469,8 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible)
if (LogwrtResult.Write >= EndPtr) if (LogwrtResult.Write >= EndPtr)
elog(PANIC, "xlog write request %X/%X is past end of log %X/%X", elog(PANIC, "xlog write request %X/%X is past end of log %X/%X",
(uint32) (LogwrtResult.Write >> 32), LSN_FORMAT_ARGS(LogwrtResult.Write),
(uint32) LogwrtResult.Write, LSN_FORMAT_ARGS(EndPtr));
(uint32) (EndPtr >> 32), (uint32) EndPtr);
/* Advance LogwrtResult.Write to end of current buffer page */ /* Advance LogwrtResult.Write to end of current buffer page */
LogwrtResult.Write = EndPtr; LogwrtResult.Write = EndPtr;
@ -2823,9 +2820,7 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
if (!force && newMinRecoveryPoint < lsn) if (!force && newMinRecoveryPoint < lsn)
elog(WARNING, elog(WARNING,
"xlog min recovery request %X/%X is past current point %X/%X", "xlog min recovery request %X/%X is past current point %X/%X",
(uint32) (lsn >> 32), (uint32) lsn, LSN_FORMAT_ARGS(lsn), LSN_FORMAT_ARGS(newMinRecoveryPoint));
(uint32) (newMinRecoveryPoint >> 32),
(uint32) newMinRecoveryPoint);
/* update control file */ /* update control file */
if (ControlFile->minRecoveryPoint < newMinRecoveryPoint) if (ControlFile->minRecoveryPoint < newMinRecoveryPoint)
@ -2838,8 +2833,7 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
ereport(DEBUG2, ereport(DEBUG2,
(errmsg_internal("updated min recovery point to %X/%X on timeline %u", (errmsg_internal("updated min recovery point to %X/%X on timeline %u",
(uint32) (minRecoveryPoint >> 32), LSN_FORMAT_ARGS(minRecoveryPoint),
(uint32) minRecoveryPoint,
newMinRecoveryPointTLI))); newMinRecoveryPointTLI)));
} }
} }
@ -2878,9 +2872,9 @@ XLogFlush(XLogRecPtr record)
#ifdef WAL_DEBUG #ifdef WAL_DEBUG
if (XLOG_DEBUG) if (XLOG_DEBUG)
elog(LOG, "xlog flush request %X/%X; write %X/%X; flush %X/%X", elog(LOG, "xlog flush request %X/%X; write %X/%X; flush %X/%X",
(uint32) (record >> 32), (uint32) record, LSN_FORMAT_ARGS(record),
(uint32) (LogwrtResult.Write >> 32), (uint32) LogwrtResult.Write, LSN_FORMAT_ARGS(LogwrtResult.Write),
(uint32) (LogwrtResult.Flush >> 32), (uint32) LogwrtResult.Flush); LSN_FORMAT_ARGS(LogwrtResult.Flush));
#endif #endif
START_CRIT_SECTION(); START_CRIT_SECTION();
@ -3013,8 +3007,8 @@ XLogFlush(XLogRecPtr record)
if (LogwrtResult.Flush < record) if (LogwrtResult.Flush < record)
elog(ERROR, elog(ERROR,
"xlog flush request %X/%X is not satisfied --- flushed only to %X/%X", "xlog flush request %X/%X is not satisfied --- flushed only to %X/%X",
(uint32) (record >> 32), (uint32) record, LSN_FORMAT_ARGS(record),
(uint32) (LogwrtResult.Flush >> 32), (uint32) LogwrtResult.Flush); LSN_FORMAT_ARGS(LogwrtResult.Flush));
} }
/* /*
@ -3129,10 +3123,10 @@ XLogBackgroundFlush(void)
#ifdef WAL_DEBUG #ifdef WAL_DEBUG
if (XLOG_DEBUG) if (XLOG_DEBUG)
elog(LOG, "xlog bg flush request write %X/%X; flush: %X/%X, current is write %X/%X; flush %X/%X", 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, LSN_FORMAT_ARGS(WriteRqst.Write),
(uint32) (WriteRqst.Flush >> 32), (uint32) WriteRqst.Flush, LSN_FORMAT_ARGS(WriteRqst.Flush),
(uint32) (LogwrtResult.Write >> 32), (uint32) LogwrtResult.Write, LSN_FORMAT_ARGS(LogwrtResult.Write),
(uint32) (LogwrtResult.Flush >> 32), (uint32) LogwrtResult.Flush); LSN_FORMAT_ARGS(LogwrtResult.Flush));
#endif #endif
START_CRIT_SECTION(); 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", (errmsg("new timeline %u forked off current database system timeline %u before current recovery point %X/%X",
newtarget, newtarget,
ThisTimeLineID, ThisTimeLineID,
(uint32) (EndRecPtr >> 32), (uint32) EndRecPtr))); LSN_FORMAT_ARGS(EndRecPtr))));
return false; return false;
} }
@ -5754,8 +5748,7 @@ recoveryStopsBefore(XLogReaderState *record)
recoveryStopName[0] = '\0'; recoveryStopName[0] = '\0';
ereport(LOG, ereport(LOG,
(errmsg("recovery stopping before WAL location (LSN) \"%X/%X\"", (errmsg("recovery stopping before WAL location (LSN) \"%X/%X\"",
(uint32) (recoveryStopLSN >> 32), LSN_FORMAT_ARGS(recoveryStopLSN))));
(uint32) recoveryStopLSN)));
return true; return true;
} }
@ -5918,8 +5911,7 @@ recoveryStopsAfter(XLogReaderState *record)
recoveryStopName[0] = '\0'; recoveryStopName[0] = '\0';
ereport(LOG, ereport(LOG,
(errmsg("recovery stopping after WAL location (LSN) \"%X/%X\"", (errmsg("recovery stopping after WAL location (LSN) \"%X/%X\"",
(uint32) (recoveryStopLSN >> 32), LSN_FORMAT_ARGS(recoveryStopLSN))));
(uint32) recoveryStopLSN)));
return true; return true;
} }
@ -6531,8 +6523,7 @@ StartupXLOG(void)
else if (recoveryTarget == RECOVERY_TARGET_LSN) else if (recoveryTarget == RECOVERY_TARGET_LSN)
ereport(LOG, ereport(LOG,
(errmsg("starting point-in-time recovery to WAL location (LSN) \"%X/%X\"", (errmsg("starting point-in-time recovery to WAL location (LSN) \"%X/%X\"",
(uint32) (recoveryTargetLSN >> 32), LSN_FORMAT_ARGS(recoveryTargetLSN))));
(uint32) recoveryTargetLSN)));
else if (recoveryTarget == RECOVERY_TARGET_IMMEDIATE) else if (recoveryTarget == RECOVERY_TARGET_IMMEDIATE)
ereport(LOG, ereport(LOG,
(errmsg("starting point-in-time recovery to earliest consistent point"))); (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); wasShutdown = ((record->xl_info & ~XLR_INFO_MASK) == XLOG_CHECKPOINT_SHUTDOWN);
ereport(DEBUG1, ereport(DEBUG1,
(errmsg_internal("checkpoint record is at %X/%X", (errmsg_internal("checkpoint record is at %X/%X",
(uint32) (checkPointLoc >> 32), (uint32) checkPointLoc))); LSN_FORMAT_ARGS(checkPointLoc))));
InRecovery = true; /* force recovery even if SHUTDOWNED */ InRecovery = true; /* force recovery even if SHUTDOWNED */
/* /*
@ -6731,7 +6722,7 @@ StartupXLOG(void)
{ {
ereport(DEBUG1, ereport(DEBUG1,
(errmsg_internal("checkpoint record is at %X/%X", (errmsg_internal("checkpoint record is at %X/%X",
(uint32) (checkPointLoc >> 32), (uint32) checkPointLoc))); LSN_FORMAT_ARGS(checkPointLoc))));
} }
else else
{ {
@ -6783,11 +6774,9 @@ StartupXLOG(void)
(errmsg("requested timeline %u is not a child of this server's history", (errmsg("requested timeline %u is not a child of this server's history",
recoveryTargetTLI), 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.", 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), LSN_FORMAT_ARGS(ControlFile->checkPoint),
(uint32) ControlFile->checkPoint,
ControlFile->checkPointCopy.ThisTimeLineID, ControlFile->checkPointCopy.ThisTimeLineID,
(uint32) (switchpoint >> 32), LSN_FORMAT_ARGS(switchpoint))));
(uint32) switchpoint)));
} }
/* /*
@ -6800,15 +6789,14 @@ StartupXLOG(void)
ereport(FATAL, ereport(FATAL,
(errmsg("requested timeline %u does not contain minimum recovery point %X/%X on timeline %u", (errmsg("requested timeline %u does not contain minimum recovery point %X/%X on timeline %u",
recoveryTargetTLI, recoveryTargetTLI,
(uint32) (ControlFile->minRecoveryPoint >> 32), LSN_FORMAT_ARGS(ControlFile->minRecoveryPoint),
(uint32) ControlFile->minRecoveryPoint,
ControlFile->minRecoveryPointTLI))); ControlFile->minRecoveryPointTLI)));
LastRec = RecPtr = checkPointLoc; LastRec = RecPtr = checkPointLoc;
ereport(DEBUG1, ereport(DEBUG1,
(errmsg_internal("redo record is at %X/%X; shutdown %s", (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"))); wasShutdown ? "true" : "false")));
ereport(DEBUG1, ereport(DEBUG1,
(errmsg_internal("next transaction ID: " UINT64_FORMAT "; next OID: %u", (errmsg_internal("next transaction ID: " UINT64_FORMAT "; next OID: %u",
@ -7254,7 +7242,7 @@ StartupXLOG(void)
ereport(LOG, ereport(LOG,
(errmsg("redo starts at %X/%X", (errmsg("redo starts at %X/%X",
(uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr))); LSN_FORMAT_ARGS(ReadRecPtr))));
/* /*
* main redo apply loop * main redo apply loop
@ -7272,8 +7260,8 @@ StartupXLOG(void)
initStringInfo(&buf); initStringInfo(&buf);
appendStringInfo(&buf, "REDO @ %X/%X; LSN %X/%X: ", appendStringInfo(&buf, "REDO @ %X/%X; LSN %X/%X: ",
(uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr, LSN_FORMAT_ARGS(ReadRecPtr),
(uint32) (EndRecPtr >> 32), (uint32) EndRecPtr); LSN_FORMAT_ARGS(EndRecPtr));
xlog_outrec(&buf, xlogreader); xlog_outrec(&buf, xlogreader);
appendStringInfoString(&buf, " - "); appendStringInfoString(&buf, " - ");
xlog_outdesc(&buf, xlogreader); xlog_outdesc(&buf, xlogreader);
@ -7516,7 +7504,7 @@ StartupXLOG(void)
ereport(LOG, ereport(LOG,
(errmsg("redo done at %X/%X system usage: %s", (errmsg("redo done at %X/%X system usage: %s",
(uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr, LSN_FORMAT_ARGS(ReadRecPtr),
pg_rusage_show(&ru0)))); pg_rusage_show(&ru0))));
xtime = GetLatestXTime(); xtime = GetLatestXTime();
if (xtime) if (xtime)
@ -7684,8 +7672,7 @@ StartupXLOG(void)
snprintf(reason, sizeof(reason), snprintf(reason, sizeof(reason),
"%s LSN %X/%X\n", "%s LSN %X/%X\n",
recoveryStopAfter ? "after" : "before", recoveryStopAfter ? "after" : "before",
(uint32) (recoveryStopLSN >> 32), LSN_FORMAT_ARGS(recoveryStopLSN));
(uint32) recoveryStopLSN);
else if (recoveryTarget == RECOVERY_TARGET_NAME) else if (recoveryTarget == RECOVERY_TARGET_NAME)
snprintf(reason, sizeof(reason), snprintf(reason, sizeof(reason),
"at restore point \"%s\"", "at restore point \"%s\"",
@ -8109,8 +8096,7 @@ CheckRecoveryConsistency(void)
reachedConsistency = true; reachedConsistency = true;
ereport(LOG, ereport(LOG,
(errmsg("consistent recovery state reached at %X/%X", (errmsg("consistent recovery state reached at %X/%X",
(uint32) (lastReplayedEndRecPtr >> 32), LSN_FORMAT_ARGS(lastReplayedEndRecPtr))));
(uint32) lastReplayedEndRecPtr)));
} }
/* /*
@ -9344,8 +9330,7 @@ RecoveryRestartPoint(const CheckPoint *checkPoint)
elog(trace_recovery(DEBUG2), elog(trace_recovery(DEBUG2),
"could not record restart point at %X/%X because there " "could not record restart point at %X/%X because there "
"are unresolved references to invalid pages", "are unresolved references to invalid pages",
(uint32) (checkPoint->redo >> 32), LSN_FORMAT_ARGS(checkPoint->redo));
(uint32) checkPoint->redo);
return; return;
} }
@ -9422,8 +9407,7 @@ CreateRestartPoint(int flags)
{ {
ereport(DEBUG2, ereport(DEBUG2,
(errmsg_internal("skipping restartpoint, already performed at %X/%X", (errmsg_internal("skipping restartpoint, already performed at %X/%X",
(uint32) (lastCheckPoint.redo >> 32), LSN_FORMAT_ARGS(lastCheckPoint.redo))));
(uint32) lastCheckPoint.redo)));
UpdateMinRecoveryPoint(InvalidXLogRecPtr, true); UpdateMinRecoveryPoint(InvalidXLogRecPtr, true);
if (flags & CHECKPOINT_IS_SHUTDOWN) if (flags & CHECKPOINT_IS_SHUTDOWN)
@ -9595,7 +9579,7 @@ CreateRestartPoint(int flags)
xtime = GetLatestXTime(); xtime = GetLatestXTime();
ereport((log_checkpoints ? LOG : DEBUG2), ereport((log_checkpoints ? LOG : DEBUG2),
(errmsg("recovery restart point at %X/%X", (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.", xtime ? errdetail("Last completed transaction was at log time %s.",
timestamptz_to_str(xtime)) : 0)); timestamptz_to_str(xtime)) : 0));
@ -9837,7 +9821,7 @@ XLogRestorePoint(const char *rpName)
ereport(LOG, ereport(LOG,
(errmsg("restore point \"%s\" created at %X/%X", (errmsg("restore point \"%s\" created at %X/%X",
rpName, (uint32) (RecPtr >> 32), (uint32) RecPtr))); rpName, LSN_FORMAT_ARGS(RecPtr))));
return RecPtr; return RecPtr;
} }
@ -10008,8 +9992,7 @@ checkTimeLineSwitch(XLogRecPtr lsn, TimeLineID newTLI, TimeLineID prevTLI)
ereport(PANIC, ereport(PANIC,
(errmsg("unexpected timeline ID %u in checkpoint record, before reaching minimum recovery point %X/%X on timeline %u", (errmsg("unexpected timeline ID %u in checkpoint record, before reaching minimum recovery point %X/%X on timeline %u",
newTLI, newTLI,
(uint32) (minRecoveryPoint >> 32), LSN_FORMAT_ARGS(minRecoveryPoint),
(uint32) minRecoveryPoint,
minRecoveryPointTLI))); minRecoveryPointTLI)));
/* Looks good */ /* Looks good */
@ -10365,8 +10348,7 @@ static void
xlog_outrec(StringInfo buf, XLogReaderState *record) xlog_outrec(StringInfo buf, XLogReaderState *record)
{ {
appendStringInfo(buf, "prev %X/%X; xid %u", appendStringInfo(buf, "prev %X/%X; xid %u",
(uint32) (XLogRecGetPrev(record) >> 32), LSN_FORMAT_ARGS(XLogRecGetPrev(record)),
(uint32) XLogRecGetPrev(record),
XLogRecGetXid(record)); XLogRecGetXid(record));
appendStringInfo(buf, "; len %u", 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", "%Y-%m-%d %H:%M:%S %Z",
pg_localtime(&stamp_time, log_timezone)); pg_localtime(&stamp_time, log_timezone));
appendStringInfo(labelfile, "START WAL LOCATION: %X/%X (file %s)\n", 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", appendStringInfo(labelfile, "CHECKPOINT LOCATION: %X/%X\n",
(uint32) (checkpointloc >> 32), (uint32) checkpointloc); LSN_FORMAT_ARGS(checkpointloc));
appendStringInfo(labelfile, "BACKUP METHOD: %s\n", appendStringInfo(labelfile, "BACKUP METHOD: %s\n",
exclusive ? "pg_start_backup" : "streamed"); exclusive ? "pg_start_backup" : "streamed");
appendStringInfo(labelfile, "BACKUP FROM: %s\n", 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", errmsg("could not create file \"%s\": %m",
histfilepath))); histfilepath)));
fprintf(fp, "START WAL LOCATION: %X/%X (file %s)\n", 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", 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 * 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 */ /* translator: %s is a WAL record description */
errcontext("WAL redo at %X/%X for %s", errcontext("WAL redo at %X/%X for %s",
(uint32) (record->ReadRecPtr >> 32), LSN_FORMAT_ARGS(record->ReadRecPtr),
(uint32) record->ReadRecPtr,
buf.data); buf.data);
pfree(buf.data); pfree(buf.data);
@ -12494,8 +12475,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
if (curFileTLI > 0 && tli < curFileTLI) 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", 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), LSN_FORMAT_ARGS(tliRecPtr),
(uint32) tliRecPtr,
tli, curFileTLI); tli, curFileTLI);
} }
curFileTLI = tli; curFileTLI = tli;

View File

@ -347,7 +347,7 @@ XLogReadRecord(XLogReaderState *state, char **errormsg)
else if (targetRecOff < pageHeaderSize) else if (targetRecOff < pageHeaderSize)
{ {
report_invalid_record(state, "invalid record offset at %X/%X", report_invalid_record(state, "invalid record offset at %X/%X",
(uint32) (RecPtr >> 32), (uint32) RecPtr); LSN_FORMAT_ARGS(RecPtr));
goto err; goto err;
} }
@ -355,7 +355,7 @@ XLogReadRecord(XLogReaderState *state, char **errormsg)
targetRecOff == pageHeaderSize) targetRecOff == pageHeaderSize)
{ {
report_invalid_record(state, "contrecord is requested by %X/%X", report_invalid_record(state, "contrecord is requested by %X/%X",
(uint32) (RecPtr >> 32), (uint32) RecPtr); LSN_FORMAT_ARGS(RecPtr));
goto err; goto err;
} }
@ -396,7 +396,7 @@ XLogReadRecord(XLogReaderState *state, char **errormsg)
{ {
report_invalid_record(state, report_invalid_record(state,
"invalid record length at %X/%X: wanted %u, got %u", "invalid record length at %X/%X: wanted %u, got %u",
(uint32) (RecPtr >> 32), (uint32) RecPtr, LSN_FORMAT_ARGS(RecPtr),
(uint32) SizeOfXLogRecord, total_len); (uint32) SizeOfXLogRecord, total_len);
goto err; goto err;
} }
@ -420,8 +420,7 @@ XLogReadRecord(XLogReaderState *state, char **errormsg)
{ {
/* We treat this as a "bogus data" condition */ /* We treat this as a "bogus data" condition */
report_invalid_record(state, "record length %u at %X/%X too long", report_invalid_record(state, "record length %u at %X/%X too long",
total_len, total_len, LSN_FORMAT_ARGS(RecPtr));
(uint32) (RecPtr >> 32), (uint32) RecPtr);
goto err; goto err;
} }
@ -452,7 +451,7 @@ XLogReadRecord(XLogReaderState *state, char **errormsg)
{ {
report_invalid_record(state, report_invalid_record(state,
"there is no contrecord flag at %X/%X", "there is no contrecord flag at %X/%X",
(uint32) (RecPtr >> 32), (uint32) RecPtr); LSN_FORMAT_ARGS(RecPtr));
goto err; goto err;
} }
@ -467,7 +466,7 @@ XLogReadRecord(XLogReaderState *state, char **errormsg)
"invalid contrecord length %u (expected %lld) at %X/%X", "invalid contrecord length %u (expected %lld) at %X/%X",
pageHeader->xlp_rem_len, pageHeader->xlp_rem_len,
((long long) total_len) - gotlen, ((long long) total_len) - gotlen,
(uint32) (RecPtr >> 32), (uint32) RecPtr); LSN_FORMAT_ARGS(RecPtr));
goto err; goto err;
} }
@ -694,7 +693,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
{ {
report_invalid_record(state, report_invalid_record(state,
"invalid record length at %X/%X: wanted %u, got %u", "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); (uint32) SizeOfXLogRecord, record->xl_tot_len);
return false; return false;
} }
@ -702,8 +701,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
{ {
report_invalid_record(state, report_invalid_record(state,
"invalid resource manager ID %u at %X/%X", "invalid resource manager ID %u at %X/%X",
record->xl_rmid, (uint32) (RecPtr >> 32), record->xl_rmid, LSN_FORMAT_ARGS(RecPtr));
(uint32) RecPtr);
return false; return false;
} }
if (randAccess) if (randAccess)
@ -716,9 +714,8 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
{ {
report_invalid_record(state, report_invalid_record(state,
"record with incorrect prev-link %X/%X at %X/%X", "record with incorrect prev-link %X/%X at %X/%X",
(uint32) (record->xl_prev >> 32), LSN_FORMAT_ARGS(record->xl_prev),
(uint32) record->xl_prev, LSN_FORMAT_ARGS(RecPtr));
(uint32) (RecPtr >> 32), (uint32) RecPtr);
return false; return false;
} }
} }
@ -733,9 +730,8 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
{ {
report_invalid_record(state, report_invalid_record(state,
"record with incorrect prev-link %X/%X at %X/%X", "record with incorrect prev-link %X/%X at %X/%X",
(uint32) (record->xl_prev >> 32), LSN_FORMAT_ARGS(record->xl_prev),
(uint32) record->xl_prev, LSN_FORMAT_ARGS(RecPtr));
(uint32) (RecPtr >> 32), (uint32) RecPtr);
return false; return false;
} }
} }
@ -770,7 +766,7 @@ ValidXLogRecord(XLogReaderState *state, XLogRecord *record, XLogRecPtr recptr)
{ {
report_invalid_record(state, report_invalid_record(state,
"incorrect resource manager data checksum in record at %X/%X", "incorrect resource manager data checksum in record at %X/%X",
(uint32) (recptr >> 32), (uint32) recptr); LSN_FORMAT_ARGS(recptr));
return false; return false;
} }
@ -881,7 +877,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
report_invalid_record(state, report_invalid_record(state,
"unexpected pageaddr %X/%X in log segment %s, offset %u", "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, fname,
offset); offset);
return false; return false;
@ -1252,8 +1248,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
report_invalid_record(state, report_invalid_record(state,
"out-of-order block_id %u at %X/%X", "out-of-order block_id %u at %X/%X",
block_id, block_id,
(uint32) (state->ReadRecPtr >> 32), LSN_FORMAT_ARGS(state->ReadRecPtr));
(uint32) state->ReadRecPtr);
goto err; goto err;
} }
state->max_block_id = block_id; state->max_block_id = block_id;
@ -1274,7 +1269,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
{ {
report_invalid_record(state, report_invalid_record(state,
"BKPBLOCK_HAS_DATA set, but no data included at %X/%X", "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; goto err;
} }
if (!blk->has_data && blk->data_len != 0) if (!blk->has_data && blk->data_len != 0)
@ -1282,7 +1277,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
report_invalid_record(state, report_invalid_record(state,
"BKPBLOCK_HAS_DATA not set, but data length is %u at %X/%X", "BKPBLOCK_HAS_DATA not set, but data length is %u at %X/%X",
(unsigned int) blk->data_len, (unsigned int) blk->data_len,
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
} }
datatotal += blk->data_len; datatotal += blk->data_len;
@ -1320,7 +1315,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
(unsigned int) blk->hole_offset, (unsigned int) blk->hole_offset,
(unsigned int) blk->hole_length, (unsigned int) blk->hole_length,
(unsigned int) blk->bimg_len, (unsigned int) blk->bimg_len,
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; 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", "BKPIMAGE_HAS_HOLE not set, but hole offset %u length %u at %X/%X",
(unsigned int) blk->hole_offset, (unsigned int) blk->hole_offset,
(unsigned int) blk->hole_length, (unsigned int) blk->hole_length,
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
} }
@ -1349,7 +1344,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
report_invalid_record(state, report_invalid_record(state,
"BKPIMAGE_IS_COMPRESSED set, but block image length %u at %X/%X", "BKPIMAGE_IS_COMPRESSED set, but block image length %u at %X/%X",
(unsigned int) blk->bimg_len, (unsigned int) blk->bimg_len,
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
} }
@ -1364,7 +1359,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
report_invalid_record(state, report_invalid_record(state,
"neither BKPIMAGE_HAS_HOLE nor BKPIMAGE_IS_COMPRESSED set, but block image length is %u at %X/%X", "neither BKPIMAGE_HAS_HOLE nor BKPIMAGE_IS_COMPRESSED set, but block image length is %u at %X/%X",
(unsigned int) blk->data_len, (unsigned int) blk->data_len,
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
} }
} }
@ -1379,7 +1374,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
{ {
report_invalid_record(state, report_invalid_record(state,
"BKPBLOCK_SAME_REL set but no previous rel at %X/%X", "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; goto err;
} }
@ -1391,9 +1386,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
{ {
report_invalid_record(state, report_invalid_record(state,
"invalid block_id %u at %X/%X", "invalid block_id %u at %X/%X",
block_id, block_id, LSN_FORMAT_ARGS(state->ReadRecPtr));
(uint32) (state->ReadRecPtr >> 32),
(uint32) state->ReadRecPtr);
goto err; goto err;
} }
} }
@ -1480,7 +1473,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
shortdata_err: shortdata_err:
report_invalid_record(state, report_invalid_record(state,
"record with invalid length at %X/%X", "record with invalid length at %X/%X",
(uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr); LSN_FORMAT_ARGS(state->ReadRecPtr));
err: err:
*errormsg = state->errormsg_buf; *errormsg = state->errormsg_buf;
@ -1569,8 +1562,7 @@ RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
BLCKSZ - bkpb->hole_length, true) < 0) BLCKSZ - bkpb->hole_length, true) < 0)
{ {
report_invalid_record(record, "invalid compressed image at %X/%X, block %d", report_invalid_record(record, "invalid compressed image at %X/%X, block %d",
(uint32) (record->ReadRecPtr >> 32), LSN_FORMAT_ARGS(record->ReadRecPtr),
(uint32) record->ReadRecPtr,
block_id); block_id);
return false; return false;
} }

View File

@ -776,8 +776,7 @@ XLogReadDetermineTimeline(XLogReaderState *state, XLogRecPtr wantPage, uint32 wa
elog(DEBUG3, "switched to timeline %u valid until %X/%X", elog(DEBUG3, "switched to timeline %u valid until %X/%X",
state->currTLI, state->currTLI,
(uint32) (state->currTLIValidUntil >> 32), LSN_FORMAT_ARGS(state->currTLIValidUntil));
(uint32) (state->currTLIValidUntil));
} }
} }

View File

@ -277,8 +277,8 @@ AddWALInfoToBackupManifest(backup_manifest_info *manifest, XLogRecPtr startptr,
"%s{ \"Timeline\": %u, \"Start-LSN\": \"%X/%X\", \"End-LSN\": \"%X/%X\" }", "%s{ \"Timeline\": %u, \"Start-LSN\": \"%X/%X\", \"End-LSN\": \"%X/%X\" }",
first_wal_range ? "" : ",\n", first_wal_range ? "" : ",\n",
entry->tli, entry->tli,
(uint32) (tl_beginptr >> 32), (uint32) tl_beginptr, LSN_FORMAT_ARGS(tl_beginptr),
(uint32) (endptr >> 32), (uint32) endptr); LSN_FORMAT_ARGS(endptr));
if (starttli == entry->tli) if (starttli == entry->tli)
{ {

View File

@ -1075,7 +1075,7 @@ SendXlogRecPtrResult(XLogRecPtr ptr, TimeLineID tli)
pq_sendint16(&buf, 2); /* number of columns */ pq_sendint16(&buf, 2); /* number of columns */
len = snprintf(str, sizeof(str), len = snprintf(str, sizeof(str),
"%X/%X", (uint32) (ptr >> 32), (uint32) ptr); "%X/%X", LSN_FORMAT_ARGS(ptr));
pq_sendint32(&buf, len); pq_sendint32(&buf, len);
pq_sendbytes(&buf, str, len); pq_sendbytes(&buf, str, len);

View File

@ -406,9 +406,7 @@ libpqrcv_startstreaming(WalReceiverConn *conn,
if (options->logical) if (options->logical)
appendStringInfoString(&cmd, " LOGICAL"); appendStringInfoString(&cmd, " LOGICAL");
appendStringInfo(&cmd, " %X/%X", appendStringInfo(&cmd, " %X/%X", LSN_FORMAT_ARGS(options->startpoint));
(uint32) (options->startpoint >> 32),
(uint32) options->startpoint);
/* /*
* Additional options are different depending on if we are doing logical * Additional options are different depending on if we are doing logical

View File

@ -514,9 +514,8 @@ CreateDecodingContext(XLogRecPtr start_lsn,
* replication. * replication.
*/ */
elog(DEBUG1, "cannot stream from %X/%X, minimum is %X/%X, forwarding", elog(DEBUG1, "cannot stream from %X/%X, minimum is %X/%X, forwarding",
(uint32) (start_lsn >> 32), (uint32) start_lsn, LSN_FORMAT_ARGS(start_lsn),
(uint32) (slot->data.confirmed_flush >> 32), LSN_FORMAT_ARGS(slot->data.confirmed_flush));
(uint32) slot->data.confirmed_flush);
start_lsn = slot->data.confirmed_flush; start_lsn = slot->data.confirmed_flush;
} }
@ -538,10 +537,8 @@ CreateDecodingContext(XLogRecPtr start_lsn,
(errmsg("starting logical decoding for slot \"%s\"", (errmsg("starting logical decoding for slot \"%s\"",
NameStr(slot->data.name)), NameStr(slot->data.name)),
errdetail("Streaming transactions committing after %X/%X, reading WAL from %X/%X.", errdetail("Streaming transactions committing after %X/%X, reading WAL from %X/%X.",
(uint32) (slot->data.confirmed_flush >> 32), LSN_FORMAT_ARGS(slot->data.confirmed_flush),
(uint32) slot->data.confirmed_flush, LSN_FORMAT_ARGS(slot->data.restart_lsn))));
(uint32) (slot->data.restart_lsn >> 32),
(uint32) slot->data.restart_lsn)));
return ctx; return ctx;
} }
@ -567,8 +564,7 @@ DecodingContextFindStartpoint(LogicalDecodingContext *ctx)
XLogBeginRead(ctx->reader, slot->data.restart_lsn); XLogBeginRead(ctx->reader, slot->data.restart_lsn);
elog(DEBUG1, "searching for logical decoding starting point, starting at %X/%X", elog(DEBUG1, "searching for logical decoding starting point, starting at %X/%X",
(uint32) (slot->data.restart_lsn >> 32), LSN_FORMAT_ARGS(slot->data.restart_lsn));
(uint32) slot->data.restart_lsn);
/* Wait for a consistent starting point */ /* Wait for a consistent starting point */
for (;;) for (;;)
@ -688,8 +684,7 @@ output_plugin_error_callback(void *arg)
NameStr(state->ctx->slot->data.name), NameStr(state->ctx->slot->data.name),
NameStr(state->ctx->slot->data.plugin), NameStr(state->ctx->slot->data.plugin),
state->callback_name, state->callback_name,
(uint32) (state->report_location >> 32), LSN_FORMAT_ARGS(state->report_location));
(uint32) state->report_location);
else else
errcontext("slot \"%s\", output plugin \"%s\", in the %s callback", errcontext("slot \"%s\", output plugin \"%s\", in the %s callback",
NameStr(state->ctx->slot->data.name), NameStr(state->ctx->slot->data.name),
@ -1623,8 +1618,8 @@ LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart
SpinLockRelease(&slot->mutex); SpinLockRelease(&slot->mutex);
elog(DEBUG1, "got new restart lsn %X/%X at %X/%X", elog(DEBUG1, "got new restart lsn %X/%X at %X/%X",
(uint32) (restart_lsn >> 32), (uint32) restart_lsn, LSN_FORMAT_ARGS(restart_lsn),
(uint32) (current_lsn >> 32), (uint32) current_lsn); LSN_FORMAT_ARGS(current_lsn));
} }
else else
{ {
@ -1638,14 +1633,11 @@ LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart
SpinLockRelease(&slot->mutex); SpinLockRelease(&slot->mutex);
elog(DEBUG1, "failed to increase restart lsn: proposed %X/%X, after %X/%X, current candidate %X/%X, current after %X/%X, flushed up to %X/%X", elog(DEBUG1, "failed to increase restart lsn: proposed %X/%X, after %X/%X, current candidate %X/%X, current after %X/%X, flushed up to %X/%X",
(uint32) (restart_lsn >> 32), (uint32) restart_lsn, LSN_FORMAT_ARGS(restart_lsn),
(uint32) (current_lsn >> 32), (uint32) current_lsn, LSN_FORMAT_ARGS(current_lsn),
(uint32) (candidate_restart_lsn >> 32), LSN_FORMAT_ARGS(candidate_restart_lsn),
(uint32) candidate_restart_lsn, LSN_FORMAT_ARGS(candidate_restart_valid),
(uint32) (candidate_restart_valid >> 32), LSN_FORMAT_ARGS(confirmed_flush));
(uint32) candidate_restart_valid,
(uint32) (confirmed_flush >> 32),
(uint32) confirmed_flush);
} }
/* candidates are already valid with the current flush position, apply */ /* candidates are already valid with the current flush position, apply */

View File

@ -789,8 +789,7 @@ StartupReplicationOrigin(void)
ereport(LOG, ereport(LOG,
(errmsg("recovered replication state of node %u to %X/%X", (errmsg("recovered replication state of node %u to %X/%X",
disk_state.roident, disk_state.roident,
(uint32) (disk_state.remote_lsn >> 32), LSN_FORMAT_ARGS(disk_state.remote_lsn))));
(uint32) disk_state.remote_lsn)));
} }
/* now check checksum */ /* now check checksum */

View File

@ -4366,8 +4366,7 @@ ReorderBufferSerializedPath(char *path, ReplicationSlot *slot, TransactionId xid
snprintf(path, MAXPGPATH, "pg_replslot/%s/xid-%u-lsn-%X-%X.spill", snprintf(path, MAXPGPATH, "pg_replslot/%s/xid-%u-lsn-%X-%X.spill",
NameStr(MyReplicationSlot->data.name), NameStr(MyReplicationSlot->data.name),
xid, xid, LSN_FORMAT_ARGS(recptr));
(uint32) (recptr >> 32), (uint32) recptr);
} }
/* /*

View File

@ -801,7 +801,7 @@ SnapBuildDistributeNewCatalogSnapshot(SnapBuild *builder, XLogRecPtr lsn)
continue; continue;
elog(DEBUG2, "adding a new snapshot to %u at %X/%X", elog(DEBUG2, "adding a new snapshot to %u at %X/%X",
txn->xid, (uint32) (lsn >> 32), (uint32) lsn); txn->xid, LSN_FORMAT_ARGS(lsn));
/* /*
* increase the snapshot's refcount for the transaction we are handing * increase the snapshot's refcount for the transaction we are handing
@ -1191,7 +1191,7 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn
{ {
ereport(DEBUG1, ereport(DEBUG1,
(errmsg_internal("skipping snapshot at %X/%X while building logical decoding snapshot, xmin horizon too low", (errmsg_internal("skipping snapshot at %X/%X while building logical decoding snapshot, xmin horizon too low",
(uint32) (lsn >> 32), (uint32) lsn), LSN_FORMAT_ARGS(lsn)),
errdetail_internal("initial xmin horizon of %u vs the snapshot's %u", errdetail_internal("initial xmin horizon of %u vs the snapshot's %u",
builder->initial_xmin_horizon, running->oldestRunningXid))); builder->initial_xmin_horizon, running->oldestRunningXid)));
@ -1230,7 +1230,7 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn
ereport(LOG, ereport(LOG,
(errmsg("logical decoding found consistent point at %X/%X", (errmsg("logical decoding found consistent point at %X/%X",
(uint32) (lsn >> 32), (uint32) lsn), LSN_FORMAT_ARGS(lsn)),
errdetail("There are no running transactions."))); errdetail("There are no running transactions.")));
return false; return false;
@ -1274,7 +1274,7 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn
ereport(LOG, ereport(LOG,
(errmsg("logical decoding found initial starting point at %X/%X", (errmsg("logical decoding found initial starting point at %X/%X",
(uint32) (lsn >> 32), (uint32) lsn), LSN_FORMAT_ARGS(lsn)),
errdetail("Waiting for transactions (approximately %d) older than %u to end.", errdetail("Waiting for transactions (approximately %d) older than %u to end.",
running->xcnt, running->nextXid))); running->xcnt, running->nextXid)));
@ -1298,7 +1298,7 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn
ereport(LOG, ereport(LOG,
(errmsg("logical decoding found initial consistent point at %X/%X", (errmsg("logical decoding found initial consistent point at %X/%X",
(uint32) (lsn >> 32), (uint32) lsn), LSN_FORMAT_ARGS(lsn)),
errdetail("Waiting for transactions (approximately %d) older than %u to end.", errdetail("Waiting for transactions (approximately %d) older than %u to end.",
running->xcnt, running->nextXid))); running->xcnt, running->nextXid)));
@ -1323,7 +1323,7 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn
ereport(LOG, ereport(LOG,
(errmsg("logical decoding found consistent point at %X/%X", (errmsg("logical decoding found consistent point at %X/%X",
(uint32) (lsn >> 32), (uint32) lsn), LSN_FORMAT_ARGS(lsn)),
errdetail("There are no old transactions anymore."))); errdetail("There are no old transactions anymore.")));
} }
@ -1477,7 +1477,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
* no hope continuing to decode anyway. * no hope continuing to decode anyway.
*/ */
sprintf(path, "pg_logical/snapshots/%X-%X.snap", sprintf(path, "pg_logical/snapshots/%X-%X.snap",
(uint32) (lsn >> 32), (uint32) lsn); LSN_FORMAT_ARGS(lsn));
/* /*
* first check whether some other backend already has written the snapshot * first check whether some other backend already has written the snapshot
@ -1520,7 +1520,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
/* to make sure only we will write to this tempfile, include pid */ /* to make sure only we will write to this tempfile, include pid */
sprintf(tmppath, "pg_logical/snapshots/%X-%X.snap.%u.tmp", sprintf(tmppath, "pg_logical/snapshots/%X-%X.snap.%u.tmp",
(uint32) (lsn >> 32), (uint32) lsn, MyProcPid); LSN_FORMAT_ARGS(lsn), MyProcPid);
/* /*
* Unlink temporary file if it already exists, needs to have been before a * Unlink temporary file if it already exists, needs to have been before a
@ -1670,7 +1670,7 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
return false; return false;
sprintf(path, "pg_logical/snapshots/%X-%X.snap", sprintf(path, "pg_logical/snapshots/%X-%X.snap",
(uint32) (lsn >> 32), (uint32) lsn); LSN_FORMAT_ARGS(lsn));
fd = OpenTransientFile(path, O_RDONLY | PG_BINARY); fd = OpenTransientFile(path, O_RDONLY | PG_BINARY);
@ -1854,7 +1854,7 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
ereport(LOG, ereport(LOG,
(errmsg("logical decoding found consistent point at %X/%X", (errmsg("logical decoding found consistent point at %X/%X",
(uint32) (lsn >> 32), (uint32) lsn), LSN_FORMAT_ARGS(lsn)),
errdetail("Logical decoding will begin using saved snapshot."))); errdetail("Logical decoding will begin using saved snapshot.")));
return true; return true;

View File

@ -1120,9 +1120,7 @@ copy_table_done:
elog(DEBUG1, elog(DEBUG1,
"LogicalRepSyncTableStart: '%s' origin_startpos lsn %X/%X", "LogicalRepSyncTableStart: '%s' origin_startpos lsn %X/%X",
originname, originname, LSN_FORMAT_ARGS(*origin_startpos));
(uint32) (*origin_startpos >> 32),
(uint32) *origin_startpos);
/* /*
* We are done with the initial data synchronization, update the state. * We are done with the initial data synchronization, update the state.

View File

@ -2359,10 +2359,9 @@ send_feedback(XLogRecPtr recvpos, bool force, bool requestReply)
elog(DEBUG2, "sending feedback (force %d) to recv %X/%X, write %X/%X, flush %X/%X", elog(DEBUG2, "sending feedback (force %d) to recv %X/%X, write %X/%X, flush %X/%X",
force, force,
(uint32) (recvpos >> 32), (uint32) recvpos, LSN_FORMAT_ARGS(recvpos),
(uint32) (writepos >> 32), (uint32) writepos, LSN_FORMAT_ARGS(writepos),
(uint32) (flushpos >> 32), (uint32) flushpos LSN_FORMAT_ARGS(flushpos));
);
walrcv_send(wrconn, reply_message->data, reply_message->len); walrcv_send(wrconn, reply_message->data, reply_message->len);

View File

@ -1242,8 +1242,7 @@ restart:
ereport(LOG, ereport(LOG,
(errmsg("invalidating slot \"%s\" because its restart_lsn %X/%X exceeds max_slot_wal_keep_size", (errmsg("invalidating slot \"%s\" because its restart_lsn %X/%X exceeds max_slot_wal_keep_size",
NameStr(slotname), NameStr(slotname),
(uint32) (restart_lsn >> 32), LSN_FORMAT_ARGS(restart_lsn))));
(uint32) restart_lsn)));
SpinLockAcquire(&s->mutex); SpinLockAcquire(&s->mutex);
s->data.invalidated_at = s->data.restart_lsn; s->data.invalidated_at = s->data.restart_lsn;

View File

@ -659,8 +659,7 @@ pg_replication_slot_advance(PG_FUNCTION_ARGS)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("cannot advance replication slot to %X/%X, minimum is %X/%X", errmsg("cannot advance replication slot to %X/%X, minimum is %X/%X",
(uint32) (moveto >> 32), (uint32) moveto, LSN_FORMAT_ARGS(moveto), LSN_FORMAT_ARGS(minlsn))));
(uint32) (minlsn >> 32), (uint32) minlsn)));
/* Do the actual slot update, depending on the slot type */ /* Do the actual slot update, depending on the slot type */
if (OidIsValid(MyReplicationSlot->data.database)) if (OidIsValid(MyReplicationSlot->data.database))

View File

@ -222,7 +222,7 @@ SyncRepWaitForLSN(XLogRecPtr lsn, bool commit)
new_status = (char *) palloc(len + 32 + 1); new_status = (char *) palloc(len + 32 + 1);
memcpy(new_status, old_status, len); memcpy(new_status, old_status, len);
sprintf(new_status + len, " waiting for %X/%X", sprintf(new_status + len, " waiting for %X/%X",
(uint32) (lsn >> 32), (uint32) lsn); LSN_FORMAT_ARGS(lsn));
set_ps_display(new_status); set_ps_display(new_status);
new_status[len] = '\0'; /* truncate off " waiting ..." */ new_status[len] = '\0'; /* truncate off " waiting ..." */
} }
@ -534,9 +534,9 @@ SyncRepReleaseWaiters(void)
LWLockRelease(SyncRepLock); LWLockRelease(SyncRepLock);
elog(DEBUG3, "released %d procs up to write %X/%X, %d procs up to flush %X/%X, %d procs up to apply %X/%X", elog(DEBUG3, "released %d procs up to write %X/%X, %d procs up to flush %X/%X, %d procs up to apply %X/%X",
numwrite, (uint32) (writePtr >> 32), (uint32) writePtr, numwrite, LSN_FORMAT_ARGS(writePtr),
numflush, (uint32) (flushPtr >> 32), (uint32) flushPtr, numflush, LSN_FORMAT_ARGS(flushPtr),
numapply, (uint32) (applyPtr >> 32), (uint32) applyPtr); numapply, LSN_FORMAT_ARGS(applyPtr));
} }
/* /*

View File

@ -392,13 +392,11 @@ WalReceiverMain(void)
if (first_stream) if (first_stream)
ereport(LOG, ereport(LOG,
(errmsg("started streaming WAL from primary at %X/%X on timeline %u", (errmsg("started streaming WAL from primary at %X/%X on timeline %u",
(uint32) (startpoint >> 32), (uint32) startpoint, LSN_FORMAT_ARGS(startpoint), startpointTLI)));
startpointTLI)));
else else
ereport(LOG, ereport(LOG,
(errmsg("restarted WAL streaming at %X/%X on timeline %u", (errmsg("restarted WAL streaming at %X/%X on timeline %u",
(uint32) (startpoint >> 32), (uint32) startpoint, LSN_FORMAT_ARGS(startpoint), startpointTLI)));
startpointTLI)));
first_stream = false; first_stream = false;
/* Initialize LogstreamResult and buffers for processing messages */ /* Initialize LogstreamResult and buffers for processing messages */
@ -465,7 +463,7 @@ WalReceiverMain(void)
(errmsg("replication terminated by primary server"), (errmsg("replication terminated by primary server"),
errdetail("End of WAL reached on timeline %u at %X/%X.", errdetail("End of WAL reached on timeline %u at %X/%X.",
startpointTLI, startpointTLI,
(uint32) (LogstreamResult.Write >> 32), (uint32) LogstreamResult.Write))); LSN_FORMAT_ARGS(LogstreamResult.Write))));
endofwal = true; endofwal = true;
break; break;
} }
@ -699,8 +697,7 @@ WalRcvWaitForStartPosition(XLogRecPtr *startpoint, TimeLineID *startpointTLI)
char activitymsg[50]; char activitymsg[50];
snprintf(activitymsg, sizeof(activitymsg), "restarting at %X/%X", snprintf(activitymsg, sizeof(activitymsg), "restarting at %X/%X",
(uint32) (*startpoint >> 32), LSN_FORMAT_ARGS(*startpoint));
(uint32) *startpoint);
set_ps_display(activitymsg); set_ps_display(activitymsg);
} }
} }
@ -1002,8 +999,7 @@ XLogWalRcvFlush(bool dying)
char activitymsg[50]; char activitymsg[50];
snprintf(activitymsg, sizeof(activitymsg), "streaming %X/%X", snprintf(activitymsg, sizeof(activitymsg), "streaming %X/%X",
(uint32) (LogstreamResult.Write >> 32), LSN_FORMAT_ARGS(LogstreamResult.Write));
(uint32) LogstreamResult.Write);
set_ps_display(activitymsg); set_ps_display(activitymsg);
} }
@ -1080,9 +1076,9 @@ XLogWalRcvSendReply(bool force, bool requestReply)
/* Send it */ /* Send it */
elog(DEBUG2, "sending write %X/%X flush %X/%X apply %X/%X%s", elog(DEBUG2, "sending write %X/%X flush %X/%X apply %X/%X%s",
(uint32) (writePtr >> 32), (uint32) writePtr, LSN_FORMAT_ARGS(writePtr),
(uint32) (flushPtr >> 32), (uint32) flushPtr, LSN_FORMAT_ARGS(flushPtr),
(uint32) (applyPtr >> 32), (uint32) applyPtr, LSN_FORMAT_ARGS(applyPtr),
requestReply ? " (reply requested)" : ""); requestReply ? " (reply requested)" : "");
walrcv_send(wrconn, reply_message.data, reply_message.len); walrcv_send(wrconn, reply_message.data, reply_message.len);

View File

@ -402,7 +402,7 @@ IdentifySystem(void)
else else
logptr = GetFlushRecPtr(); logptr = GetFlushRecPtr();
snprintf(xloc, sizeof(xloc), "%X/%X", (uint32) (logptr >> 32), (uint32) logptr); snprintf(xloc, sizeof(xloc), "%X/%X", LSN_FORMAT_ARGS(logptr));
if (MyDatabaseId != InvalidOid) if (MyDatabaseId != InvalidOid)
{ {
@ -674,13 +674,11 @@ StartReplication(StartReplicationCmd *cmd)
{ {
ereport(ERROR, ereport(ERROR,
(errmsg("requested starting point %X/%X on timeline %u is not in this server's history", (errmsg("requested starting point %X/%X on timeline %u is not in this server's history",
(uint32) (cmd->startpoint >> 32), LSN_FORMAT_ARGS(cmd->startpoint),
(uint32) (cmd->startpoint),
cmd->timeline), cmd->timeline),
errdetail("This server's history forked from timeline %u at %X/%X.", errdetail("This server's history forked from timeline %u at %X/%X.",
cmd->timeline, cmd->timeline,
(uint32) (switchpoint >> 32), LSN_FORMAT_ARGS(switchpoint))));
(uint32) (switchpoint))));
} }
sendTimeLineValidUpto = switchpoint; sendTimeLineValidUpto = switchpoint;
} }
@ -723,10 +721,8 @@ StartReplication(StartReplicationCmd *cmd)
{ {
ereport(ERROR, ereport(ERROR,
(errmsg("requested starting point %X/%X is ahead of the WAL flush position of this server %X/%X", (errmsg("requested starting point %X/%X is ahead of the WAL flush position of this server %X/%X",
(uint32) (cmd->startpoint >> 32), LSN_FORMAT_ARGS(cmd->startpoint),
(uint32) (cmd->startpoint), LSN_FORMAT_ARGS(FlushPtr))));
(uint32) (FlushPtr >> 32),
(uint32) (FlushPtr))));
} }
/* Start streaming from the requested point */ /* Start streaming from the requested point */
@ -769,8 +765,7 @@ StartReplication(StartReplicationCmd *cmd)
bool nulls[2]; bool nulls[2];
snprintf(startpos_str, sizeof(startpos_str), "%X/%X", snprintf(startpos_str, sizeof(startpos_str), "%X/%X",
(uint32) (sendTimeLineValidUpto >> 32), LSN_FORMAT_ARGS(sendTimeLineValidUpto));
(uint32) sendTimeLineValidUpto);
dest = CreateDestReceiver(DestRemoteSimple); dest = CreateDestReceiver(DestRemoteSimple);
MemSet(nulls, false, sizeof(nulls)); MemSet(nulls, false, sizeof(nulls));
@ -1063,8 +1058,7 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
} }
snprintf(xloc, sizeof(xloc), "%X/%X", snprintf(xloc, sizeof(xloc), "%X/%X",
(uint32) (MyReplicationSlot->data.confirmed_flush >> 32), LSN_FORMAT_ARGS(MyReplicationSlot->data.confirmed_flush));
(uint32) MyReplicationSlot->data.confirmed_flush);
dest = CreateDestReceiver(DestRemoteSimple); dest = CreateDestReceiver(DestRemoteSimple);
MemSet(nulls, false, sizeof(nulls)); MemSet(nulls, false, sizeof(nulls));
@ -1900,9 +1894,9 @@ ProcessStandbyReplyMessage(void)
replyTimeStr = pstrdup(timestamptz_to_str(replyTime)); replyTimeStr = pstrdup(timestamptz_to_str(replyTime));
elog(DEBUG2, "write %X/%X flush %X/%X apply %X/%X%s reply_time %s", elog(DEBUG2, "write %X/%X flush %X/%X apply %X/%X%s reply_time %s",
(uint32) (writePtr >> 32), (uint32) writePtr, LSN_FORMAT_ARGS(writePtr),
(uint32) (flushPtr >> 32), (uint32) flushPtr, LSN_FORMAT_ARGS(flushPtr),
(uint32) (applyPtr >> 32), (uint32) applyPtr, LSN_FORMAT_ARGS(applyPtr),
replyRequested ? " (reply requested)" : "", replyRequested ? " (reply requested)" : "",
replyTimeStr); replyTimeStr);
@ -2694,8 +2688,8 @@ XLogSendPhysical(void)
WalSndCaughtUp = true; WalSndCaughtUp = true;
elog(DEBUG1, "walsender reached end of timeline at %X/%X (sent up to %X/%X)", elog(DEBUG1, "walsender reached end of timeline at %X/%X (sent up to %X/%X)",
(uint32) (sendTimeLineValidUpto >> 32), (uint32) sendTimeLineValidUpto, LSN_FORMAT_ARGS(sendTimeLineValidUpto),
(uint32) (sentPtr >> 32), (uint32) sentPtr); LSN_FORMAT_ARGS(sentPtr));
return; return;
} }
@ -2826,7 +2820,7 @@ retry:
char activitymsg[50]; char activitymsg[50];
snprintf(activitymsg, sizeof(activitymsg), "streaming %X/%X", snprintf(activitymsg, sizeof(activitymsg), "streaming %X/%X",
(uint32) (sentPtr >> 32), (uint32) sentPtr); LSN_FORMAT_ARGS(sentPtr));
set_ps_display(activitymsg); set_ps_display(activitymsg);
} }
} }

View File

@ -1262,7 +1262,7 @@ LogCurrentRunningXacts(RunningTransactions CurrRunningXacts)
elog(trace_recovery(DEBUG2), elog(trace_recovery(DEBUG2),
"snapshot of %u running transactions overflowed (lsn %X/%X oldest xid %u latest complete %u next xid %u)", "snapshot of %u running transactions overflowed (lsn %X/%X oldest xid %u latest complete %u next xid %u)",
CurrRunningXacts->xcnt, CurrRunningXacts->xcnt,
(uint32) (recptr >> 32), (uint32) recptr, LSN_FORMAT_ARGS(recptr),
CurrRunningXacts->oldestRunningXid, CurrRunningXacts->oldestRunningXid,
CurrRunningXacts->latestCompletedXid, CurrRunningXacts->latestCompletedXid,
CurrRunningXacts->nextXid); CurrRunningXacts->nextXid);
@ -1270,7 +1270,7 @@ LogCurrentRunningXacts(RunningTransactions CurrRunningXacts)
elog(trace_recovery(DEBUG2), elog(trace_recovery(DEBUG2),
"snapshot of %u+%u running transaction ids (lsn %X/%X oldest xid %u latest complete %u next xid %u)", "snapshot of %u+%u running transaction ids (lsn %X/%X oldest xid %u latest complete %u next xid %u)",
CurrRunningXacts->xcnt, CurrRunningXacts->subxcnt, CurrRunningXacts->xcnt, CurrRunningXacts->subxcnt,
(uint32) (recptr >> 32), (uint32) recptr, LSN_FORMAT_ARGS(recptr),
CurrRunningXacts->oldestRunningXid, CurrRunningXacts->oldestRunningXid,
CurrRunningXacts->latestCompletedXid, CurrRunningXacts->latestCompletedXid,
CurrRunningXacts->nextXid); CurrRunningXacts->nextXid);

View File

@ -83,14 +83,8 @@ pg_lsn_out(PG_FUNCTION_ARGS)
XLogRecPtr lsn = PG_GETARG_LSN(0); XLogRecPtr lsn = PG_GETARG_LSN(0);
char buf[MAXPG_LSNLEN + 1]; char buf[MAXPG_LSNLEN + 1];
char *result; char *result;
uint32 id,
off;
/* Decode ID and offset */ snprintf(buf, sizeof buf, "%X/%X", LSN_FORMAT_ARGS(lsn));
id = (uint32) (lsn >> 32);
off = (uint32) lsn;
snprintf(buf, sizeof buf, "%X/%X", id, off);
result = pstrdup(buf); result = pstrdup(buf);
PG_RETURN_CSTRING(result); PG_RETURN_CSTRING(result);
} }

View File

@ -115,14 +115,14 @@ stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished)
/* we assume that we get called once at the end of each segment */ /* we assume that we get called once at the end of each segment */
if (verbose && segment_finished) if (verbose && segment_finished)
pg_log_info("finished segment at %X/%X (timeline %u)", pg_log_info("finished segment at %X/%X (timeline %u)",
(uint32) (xlogpos >> 32), (uint32) xlogpos, LSN_FORMAT_ARGS(xlogpos),
timeline); timeline);
if (!XLogRecPtrIsInvalid(endpos) && endpos < xlogpos) if (!XLogRecPtrIsInvalid(endpos) && endpos < xlogpos)
{ {
if (verbose) if (verbose)
pg_log_info("stopped log streaming at %X/%X (timeline %u)", pg_log_info("stopped log streaming at %X/%X (timeline %u)",
(uint32) (xlogpos >> 32), (uint32) xlogpos, LSN_FORMAT_ARGS(xlogpos),
timeline); timeline);
time_to_stop = true; time_to_stop = true;
return true; return true;
@ -139,7 +139,7 @@ stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished)
if (verbose && prevtimeline != 0 && prevtimeline != timeline) if (verbose && prevtimeline != 0 && prevtimeline != timeline)
pg_log_info("switched to timeline %u at %X/%X", pg_log_info("switched to timeline %u at %X/%X",
timeline, timeline,
(uint32) (prevpos >> 32), (uint32) prevpos); LSN_FORMAT_ARGS(prevpos));
prevtimeline = timeline; prevtimeline = timeline;
prevpos = xlogpos; prevpos = xlogpos;
@ -420,7 +420,7 @@ StreamLog(void)
*/ */
if (verbose) if (verbose)
pg_log_info("starting log streaming at %X/%X (timeline %u)", pg_log_info("starting log streaming at %X/%X (timeline %u)",
(uint32) (stream.startpos >> 32), (uint32) stream.startpos, LSN_FORMAT_ARGS(stream.startpos),
stream.timeline); stream.timeline);
stream.stream_stop = stop_streaming; stream.stream_stop = stop_streaming;

View File

@ -131,8 +131,8 @@ sendFeedback(PGconn *conn, TimestampTz now, bool force, bool replyRequested)
if (verbose) if (verbose)
pg_log_info("confirming write up to %X/%X, flush to %X/%X (slot %s)", pg_log_info("confirming write up to %X/%X, flush to %X/%X (slot %s)",
(uint32) (output_written_lsn >> 32), (uint32) output_written_lsn, LSN_FORMAT_ARGS(output_written_lsn),
(uint32) (output_fsync_lsn >> 32), (uint32) output_fsync_lsn, LSN_FORMAT_ARGS(output_fsync_lsn),
replication_slot); replication_slot);
replybuf[len] = 'r'; replybuf[len] = 'r';
@ -228,12 +228,12 @@ StreamLogicalLog(void)
*/ */
if (verbose) if (verbose)
pg_log_info("starting log streaming at %X/%X (slot %s)", pg_log_info("starting log streaming at %X/%X (slot %s)",
(uint32) (startpos >> 32), (uint32) startpos, LSN_FORMAT_ARGS(startpos),
replication_slot); replication_slot);
/* Initiate the replication stream at specified location */ /* Initiate the replication stream at specified location */
appendPQExpBuffer(query, "START_REPLICATION SLOT \"%s\" LOGICAL %X/%X", appendPQExpBuffer(query, "START_REPLICATION SLOT \"%s\" LOGICAL %X/%X",
replication_slot, (uint32) (startpos >> 32), (uint32) startpos); replication_slot, LSN_FORMAT_ARGS(startpos));
/* print options if there are any */ /* print options if there are any */
if (noptions) if (noptions)
@ -1045,10 +1045,9 @@ prepareToTerminate(PGconn *conn, XLogRecPtr endpos, bool keepalive, XLogRecPtr l
{ {
if (keepalive) if (keepalive)
pg_log_info("end position %X/%X reached by keepalive", pg_log_info("end position %X/%X reached by keepalive",
(uint32) (endpos >> 32), (uint32) endpos); LSN_FORMAT_ARGS(endpos));
else else
pg_log_info("end position %X/%X reached by WAL record at %X/%X", pg_log_info("end position %X/%X reached by WAL record at %X/%X",
(uint32) (endpos >> 32), (uint32) (endpos), LSN_FORMAT_ARGS(endpos), LSN_FORMAT_ARGS(lsn));
(uint32) (lsn >> 32), (uint32) lsn);
} }
} }

View File

@ -560,7 +560,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
/* Initiate the replication stream at specified location */ /* Initiate the replication stream at specified location */
snprintf(query, sizeof(query), "START_REPLICATION %s%X/%X TIMELINE %u", snprintf(query, sizeof(query), "START_REPLICATION %s%X/%X TIMELINE %u",
slotcmd, slotcmd,
(uint32) (stream->startpos >> 32), (uint32) stream->startpos, LSN_FORMAT_ARGS(stream->startpos),
stream->timeline); stream->timeline);
res = PQexec(conn, query); res = PQexec(conn, query);
if (PQresultStatus(res) != PGRES_COPY_BOTH) if (PQresultStatus(res) != PGRES_COPY_BOTH)
@ -616,8 +616,8 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
if (stream->startpos > stoppos) if (stream->startpos > stoppos)
{ {
pg_log_error("server stopped streaming timeline %u at %X/%X, but reported next timeline %u to begin at %X/%X", pg_log_error("server stopped streaming timeline %u at %X/%X, but reported next timeline %u to begin at %X/%X",
stream->timeline, (uint32) (stoppos >> 32), (uint32) stoppos, stream->timeline, LSN_FORMAT_ARGS(stoppos),
newtimeline, (uint32) (stream->startpos >> 32), (uint32) stream->startpos); newtimeline, LSN_FORMAT_ARGS(stream->startpos));
goto error; goto error;
} }

View File

@ -236,11 +236,9 @@ main(int argc, char *argv[])
printf(_("pg_control last modified: %s\n"), printf(_("pg_control last modified: %s\n"),
pgctime_str); pgctime_str);
printf(_("Latest checkpoint location: %X/%X\n"), printf(_("Latest checkpoint location: %X/%X\n"),
(uint32) (ControlFile->checkPoint >> 32), LSN_FORMAT_ARGS(ControlFile->checkPoint));
(uint32) ControlFile->checkPoint);
printf(_("Latest checkpoint's REDO location: %X/%X\n"), printf(_("Latest checkpoint's REDO location: %X/%X\n"),
(uint32) (ControlFile->checkPointCopy.redo >> 32), LSN_FORMAT_ARGS(ControlFile->checkPointCopy.redo));
(uint32) ControlFile->checkPointCopy.redo);
printf(_("Latest checkpoint's REDO WAL file: %s\n"), printf(_("Latest checkpoint's REDO WAL file: %s\n"),
xlogfilename); xlogfilename);
printf(_("Latest checkpoint's TimeLineID: %u\n"), printf(_("Latest checkpoint's TimeLineID: %u\n"),
@ -275,19 +273,15 @@ main(int argc, char *argv[])
printf(_("Time of latest checkpoint: %s\n"), printf(_("Time of latest checkpoint: %s\n"),
ckpttime_str); ckpttime_str);
printf(_("Fake LSN counter for unlogged rels: %X/%X\n"), printf(_("Fake LSN counter for unlogged rels: %X/%X\n"),
(uint32) (ControlFile->unloggedLSN >> 32), LSN_FORMAT_ARGS(ControlFile->unloggedLSN));
(uint32) ControlFile->unloggedLSN);
printf(_("Minimum recovery ending location: %X/%X\n"), printf(_("Minimum recovery ending location: %X/%X\n"),
(uint32) (ControlFile->minRecoveryPoint >> 32), LSN_FORMAT_ARGS(ControlFile->minRecoveryPoint));
(uint32) ControlFile->minRecoveryPoint);
printf(_("Min recovery ending loc's timeline: %u\n"), printf(_("Min recovery ending loc's timeline: %u\n"),
ControlFile->minRecoveryPointTLI); ControlFile->minRecoveryPointTLI);
printf(_("Backup start location: %X/%X\n"), printf(_("Backup start location: %X/%X\n"),
(uint32) (ControlFile->backupStartPoint >> 32), LSN_FORMAT_ARGS(ControlFile->backupStartPoint));
(uint32) ControlFile->backupStartPoint);
printf(_("Backup end location: %X/%X\n"), printf(_("Backup end location: %X/%X\n"),
(uint32) (ControlFile->backupEndPoint >> 32), LSN_FORMAT_ARGS(ControlFile->backupEndPoint));
(uint32) ControlFile->backupEndPoint);
printf(_("End-of-backup record required: %s\n"), printf(_("End-of-backup record required: %s\n"),
ControlFile->backupEndRequired ? _("yes") : _("no")); ControlFile->backupEndRequired ? _("yes") : _("no"));
printf(_("wal_level setting: %s\n"), printf(_("wal_level setting: %s\n"),

View File

@ -87,11 +87,11 @@ extractPageMap(const char *datadir, XLogRecPtr startpoint, int tliIndex,
if (errormsg) if (errormsg)
pg_fatal("could not read WAL record at %X/%X: %s", pg_fatal("could not read WAL record at %X/%X: %s",
(uint32) (errptr >> 32), (uint32) (errptr), LSN_FORMAT_ARGS(errptr),
errormsg); errormsg);
else else
pg_fatal("could not read WAL record at %X/%X", pg_fatal("could not read WAL record at %X/%X",
(uint32) (errptr >> 32), (uint32) (errptr)); LSN_FORMAT_ARGS(errptr));
} }
extractPageInfo(xlogreader); extractPageInfo(xlogreader);
@ -140,10 +140,10 @@ readOneRecord(const char *datadir, XLogRecPtr ptr, int tliIndex,
{ {
if (errormsg) if (errormsg)
pg_fatal("could not read WAL record at %X/%X: %s", pg_fatal("could not read WAL record at %X/%X: %s",
(uint32) (ptr >> 32), (uint32) (ptr), errormsg); LSN_FORMAT_ARGS(ptr), errormsg);
else else
pg_fatal("could not read WAL record at %X/%X", pg_fatal("could not read WAL record at %X/%X",
(uint32) (ptr >> 32), (uint32) (ptr)); LSN_FORMAT_ARGS(ptr));
} }
endptr = xlogreader->EndRecPtr; endptr = xlogreader->EndRecPtr;
@ -206,11 +206,11 @@ findLastCheckpoint(const char *datadir, XLogRecPtr forkptr, int tliIndex,
{ {
if (errormsg) if (errormsg)
pg_fatal("could not find previous WAL record at %X/%X: %s", pg_fatal("could not find previous WAL record at %X/%X: %s",
(uint32) (searchptr >> 32), (uint32) (searchptr), LSN_FORMAT_ARGS(searchptr),
errormsg); errormsg);
else else
pg_fatal("could not find previous WAL record at %X/%X", pg_fatal("could not find previous WAL record at %X/%X",
(uint32) (searchptr >> 32), (uint32) (searchptr)); LSN_FORMAT_ARGS(searchptr));
} }
/* /*
@ -428,7 +428,7 @@ extractPageInfo(XLogReaderState *record)
*/ */
pg_fatal("WAL record modifies a relation, but record type is not recognized: " pg_fatal("WAL record modifies a relation, but record type is not recognized: "
"lsn: %X/%X, rmgr: %s, info: %02X", "lsn: %X/%X, rmgr: %s, info: %02X",
(uint32) (record->ReadRecPtr >> 32), (uint32) (record->ReadRecPtr), LSN_FORMAT_ARGS(record->ReadRecPtr),
RmgrNames[rmid], info); RmgrNames[rmid], info);
} }

View File

@ -344,7 +344,7 @@ main(int argc, char **argv)
findCommonAncestorTimeline(&divergerec, &lastcommontliIndex); findCommonAncestorTimeline(&divergerec, &lastcommontliIndex);
pg_log_info("servers diverged at WAL location %X/%X on timeline %u", pg_log_info("servers diverged at WAL location %X/%X on timeline %u",
(uint32) (divergerec >> 32), (uint32) divergerec, LSN_FORMAT_ARGS(divergerec),
targetHistory[lastcommontliIndex].tli); targetHistory[lastcommontliIndex].tli);
/* /*
@ -401,8 +401,7 @@ main(int argc, char **argv)
findLastCheckpoint(datadir_target, divergerec, lastcommontliIndex, findLastCheckpoint(datadir_target, divergerec, lastcommontliIndex,
&chkptrec, &chkpttli, &chkptredo, restore_command); &chkptrec, &chkpttli, &chkptredo, restore_command);
pg_log_info("rewinding from last common checkpoint at %X/%X on timeline %u", pg_log_info("rewinding from last common checkpoint at %X/%X on timeline %u",
(uint32) (chkptrec >> 32), (uint32) chkptrec, LSN_FORMAT_ARGS(chkptrec), chkpttli);
chkpttli);
/* Initialize the hash table to track the status of each file */ /* Initialize the hash table to track the status of each file */
filehash_init(); filehash_init();
@ -859,8 +858,8 @@ getTimelineHistory(ControlFileData *controlFile, int *nentries)
entry = &history[i]; entry = &history[i];
pg_log_debug("%d: %X/%X - %X/%X", entry->tli, pg_log_debug("%d: %X/%X - %X/%X", entry->tli,
(uint32) (entry->begin >> 32), (uint32) (entry->begin), LSN_FORMAT_ARGS(entry->begin),
(uint32) (entry->end >> 32), (uint32) (entry->end)); LSN_FORMAT_ARGS(entry->end));
} }
} }
@ -954,8 +953,8 @@ createBackupLabel(XLogRecPtr startpoint, TimeLineID starttli, XLogRecPtr checkpo
"BACKUP FROM: standby\n" "BACKUP FROM: standby\n"
"START TIME: %s\n", "START TIME: %s\n",
/* omit LABEL: line */ /* omit LABEL: line */
(uint32) (startpoint >> 32), (uint32) startpoint, xlogfilename, LSN_FORMAT_ARGS(startpoint), xlogfilename,
(uint32) (checkpointloc >> 32), (uint32) checkpointloc, LSN_FORMAT_ARGS(checkpointloc),
strfbuf); strfbuf);
if (len >= sizeof(buf)) if (len >= sizeof(buf))
pg_fatal("backup label buffer too small"); /* shouldn't happen */ pg_fatal("backup label buffer too small"); /* shouldn't happen */

View File

@ -816,10 +816,8 @@ parse_required_wal(verifier_context *context, char *pg_waldump_path,
pg_waldump_cmd = psprintf("\"%s\" --quiet --path=\"%s\" --timeline=%u --start=%X/%X --end=%X/%X\n", pg_waldump_cmd = psprintf("\"%s\" --quiet --path=\"%s\" --timeline=%u --start=%X/%X --end=%X/%X\n",
pg_waldump_path, wal_directory, this_wal_range->tli, pg_waldump_path, wal_directory, this_wal_range->tli,
(uint32) (this_wal_range->start_lsn >> 32), LSN_FORMAT_ARGS(this_wal_range->start_lsn),
(uint32) this_wal_range->start_lsn, LSN_FORMAT_ARGS(this_wal_range->end_lsn));
(uint32) (this_wal_range->end_lsn >> 32),
(uint32) this_wal_range->end_lsn);
if (system(pg_waldump_cmd) != 0) if (system(pg_waldump_cmd) != 0)
report_backup_error(context, report_backup_error(context,
"WAL parsing failed for timeline %u", "WAL parsing failed for timeline %u",

View File

@ -467,8 +467,8 @@ XLogDumpDisplayRecord(XLogDumpConfig *config, XLogReaderState *record)
desc->rm_name, desc->rm_name,
rec_len, XLogRecGetTotalLen(record), rec_len, XLogRecGetTotalLen(record),
XLogRecGetXid(record), XLogRecGetXid(record),
(uint32) (record->ReadRecPtr >> 32), (uint32) record->ReadRecPtr, LSN_FORMAT_ARGS(record->ReadRecPtr),
(uint32) (xl_prev >> 32), (uint32) xl_prev); LSN_FORMAT_ARGS(xl_prev));
id = desc->rm_identify(info); id = desc->rm_identify(info);
if (id == NULL) if (id == NULL)
@ -972,8 +972,7 @@ main(int argc, char **argv)
else if (!XLByteInSeg(private.startptr, segno, WalSegSz)) else if (!XLByteInSeg(private.startptr, segno, WalSegSz))
{ {
pg_log_error("start WAL location %X/%X is not inside file \"%s\"", pg_log_error("start WAL location %X/%X is not inside file \"%s\"",
(uint32) (private.startptr >> 32), LSN_FORMAT_ARGS(private.startptr),
(uint32) private.startptr,
fname); fname);
goto bad_argument; goto bad_argument;
} }
@ -1015,8 +1014,7 @@ main(int argc, char **argv)
private.endptr != (segno + 1) * WalSegSz) private.endptr != (segno + 1) * WalSegSz)
{ {
pg_log_error("end WAL location %X/%X is not inside file \"%s\"", pg_log_error("end WAL location %X/%X is not inside file \"%s\"",
(uint32) (private.endptr >> 32), LSN_FORMAT_ARGS(private.endptr),
(uint32) private.endptr,
argv[argc - 1]); argv[argc - 1]);
goto bad_argument; goto bad_argument;
} }
@ -1048,8 +1046,7 @@ main(int argc, char **argv)
if (first_record == InvalidXLogRecPtr) if (first_record == InvalidXLogRecPtr)
fatal_error("could not find a valid record after %X/%X", fatal_error("could not find a valid record after %X/%X",
(uint32) (private.startptr >> 32), LSN_FORMAT_ARGS(private.startptr));
(uint32) private.startptr);
/* /*
* Display a message that we're skipping data if `from` wasn't a pointer * Display a message that we're skipping data if `from` wasn't a pointer
@ -1061,8 +1058,8 @@ main(int argc, char **argv)
printf(ngettext("first record is after %X/%X, at %X/%X, skipping over %u byte\n", printf(ngettext("first record is after %X/%X, at %X/%X, skipping over %u byte\n",
"first record is after %X/%X, at %X/%X, skipping over %u bytes\n", "first record is after %X/%X, at %X/%X, skipping over %u bytes\n",
(first_record - private.startptr)), (first_record - private.startptr)),
(uint32) (private.startptr >> 32), (uint32) private.startptr, LSN_FORMAT_ARGS(private.startptr),
(uint32) (first_record >> 32), (uint32) first_record, LSN_FORMAT_ARGS(first_record),
(uint32) (first_record - private.startptr)); (uint32) (first_record - private.startptr));
for (;;) for (;;)
@ -1110,8 +1107,7 @@ main(int argc, char **argv)
if (errormsg) if (errormsg)
fatal_error("error in WAL record at %X/%X: %s", fatal_error("error in WAL record at %X/%X: %s",
(uint32) (xlogreader_state->ReadRecPtr >> 32), LSN_FORMAT_ARGS(xlogreader_state->ReadRecPtr),
(uint32) xlogreader_state->ReadRecPtr,
errormsg); errormsg);
XLogReaderFree(xlogreader_state); XLogReaderFree(xlogreader_state);

View File

@ -35,6 +35,13 @@ typedef uint64 XLogRecPtr;
*/ */
#define FirstNormalUnloggedLSN ((XLogRecPtr) 1000) #define FirstNormalUnloggedLSN ((XLogRecPtr) 1000)
/*
* Handy macro for printing XLogRecPtr in conventional format, e.g.,
*
* printf("%X/%X", LSN_FORMAT_ARGS(lsn));
*/
#define LSN_FORMAT_ARGS(lsn) (AssertVariableIsOfTypeMacro((lsn), XLogRecPtr), (uint32) ((lsn) >> 32)), ((uint32) (lsn))
/* /*
* XLogSegNo - physical log file sequence number. * XLogSegNo - physical log file sequence number.
*/ */