state->targetblock,
BTreeTupleGetNAtts(itup, state->rel),
P_ISLEAF(topaque) ? "heap" : "index",
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
}
}
errdetail_internal("Index tid=(%u,%u) tuple size=%zu lp_len=%u page lsn=%X/%X.",
state->targetblock, offset,
tupsize, ItemIdGetLength(itemid),
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn),
+ LSN_FORMAT_ARGS(state->targetlsn)),
errhint("This could be a torn page problem.")));
/* Check the number of index tuple attributes */
BTreeTupleGetNAtts(itup, state->rel),
P_ISLEAF(topaque) ? "heap" : "index",
htid,
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
}
/*
RelationGetRelationName(state->rel)),
errdetail_internal("Index tid=%s points to heap tid=%s page lsn=%X/%X.",
itid, htid,
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
}
/*
RelationGetRelationName(state->rel)),
errdetail_internal("Index tid=%s posting list offset=%d page lsn=%X/%X.",
itid, i,
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
}
ItemPointerCopy(current, &last);
itid,
P_ISLEAF(topaque) ? "heap" : "index",
htid,
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
}
/* Fingerprint leaf page tuples (those that point to the heap) */
itid,
P_ISLEAF(topaque) ? "heap" : "index",
htid,
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
}
/* Reset, in case scantid was set to (itup) posting tuple's max TID */
skey->scantid = scantid;
nitid,
P_ISLEAF(topaque) ? "heap" : "index",
nhtid,
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
}
/*
RelationGetRelationName(state->rel)),
errdetail_internal("Last item on page tid=(%u,%u) page lsn=%X/%X.",
state->targetblock, offset,
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
}
}
RelationGetRelationName(state->rel)),
errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.",
state->targetblock, blkno,
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
/* Check level for non-ignorable page */
if (!P_IGNORE(opaque) && opaque->btpo.level != target_level - 1)
RelationGetRelationName(state->rel)),
errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.",
state->targetblock, blkno,
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
pivotkey_offset = P_HIKEY;
}
itemid = PageGetItemIdCareful(state, state->targetblock,
RelationGetRelationName(state->rel)),
errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.",
state->targetblock, blkno,
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
itup = state->lowkey;
}
RelationGetRelationName(state->rel)),
errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.",
state->targetblock, blkno,
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
}
}
RelationGetRelationName(state->rel)),
errdetail_internal("Parent block=%u child block=%u parent page lsn=%X/%X.",
state->targetblock, childblock,
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
for (offset = P_FIRSTDATAKEY(copaque);
offset <= maxoffset;
RelationGetRelationName(state->rel)),
errdetail_internal("Parent block=%u child index tid=(%u,%u) parent page lsn=%X/%X.",
state->targetblock, childblock, offset,
- (uint32) (state->targetlsn >> 32),
- (uint32) state->targetlsn)));
+ LSN_FORMAT_ARGS(state->targetlsn))));
}
pfree(child);
errdetail_internal("Block=%u level=%u left sibling=%u page lsn=%X/%X.",
blkno, opaque->btpo.level,
opaque->btpo_prev,
- (uint32) (pagelsn >> 32),
- (uint32) pagelsn)));
+ LSN_FORMAT_ARGS(pagelsn))));
return;
}
RelationGetRelationName(state->rel)),
errdetail_internal("Block=%u page lsn=%X/%X.",
blkno,
- (uint32) (pagelsn >> 32),
- (uint32) pagelsn)));
+ LSN_FORMAT_ARGS(pagelsn))));
/* 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\"",
RelationGetRelationName(state->rel)),
errdetail_internal("Top parent/target block=%u leaf block=%u top parent/under check lsn=%X/%X.",
blkno, childblk,
- (uint32) (pagelsn >> 32),
- (uint32) pagelsn)));
+ LSN_FORMAT_ARGS(pagelsn))));
/*
* Iff leaf page is half-dead, its high key top parent link should point
RelationGetRelationName(state->rel)),
errdetail_internal("Block=%u level=%u page lsn=%X/%X.",
blkno, opaque->btpo.level,
- (uint32) (pagelsn >> 32),
- (uint32) pagelsn)));
+ LSN_FORMAT_ARGS(pagelsn))));
}
/*
{
char lsnchar[64];
- snprintf(lsnchar, sizeof(lsnchar), "%X/%X",
- (uint32) (lsn >> 32), (uint32) lsn);
+ snprintf(lsnchar, sizeof(lsnchar), "%X/%X", LSN_FORMAT_ARGS(lsn));
values[0] = CStringGetTextDatum(lsnchar);
}
else
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);
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,
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;
}
{
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));
}
}
"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",
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)
{
"%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);
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);
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
{
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;
}
if (expectedEndPtr != endptr)
elog(PANIC, "could not find WAL buffer for %X/%X",
- (uint32) (ptr >> 32), (uint32) ptr);
+ LSN_FORMAT_ARGS(ptr));
}
else
{
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
}
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;
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)
ereport(DEBUG2,
(errmsg_internal("updated min recovery point to %X/%X on timeline %u",
- (uint32) (minRecoveryPoint >> 32),
- (uint32) minRecoveryPoint,
+ LSN_FORMAT_ARGS(minRecoveryPoint),
newMinRecoveryPointTLI)));
}
}
#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();
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));
}
/*
#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();
(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;
}
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;
}
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;
}
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")));
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 */
/*
{
ereport(DEBUG1,
(errmsg_internal("checkpoint record is at %X/%X",
- (uint32) (checkPointLoc >> 32), (uint32) checkPointLoc)));
+ LSN_FORMAT_ARGS(checkPointLoc))));
}
else
{
(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))));
}
/*
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",
ereport(LOG,
(errmsg("redo starts at %X/%X",
- (uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr)));
+ LSN_FORMAT_ARGS(ReadRecPtr))));
/*
* main redo apply loop
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);
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)
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\"",
reachedConsistency = true;
ereport(LOG,
(errmsg("consistent recovery state reached at %X/%X",
- (uint32) (lastReplayedEndRecPtr >> 32),
- (uint32) lastReplayedEndRecPtr)));
+ LSN_FORMAT_ARGS(lastReplayedEndRecPtr))));
}
/*
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;
}
{
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)
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));
ereport(LOG,
(errmsg("restore point \"%s\" created at %X/%X",
- rpName, (uint32) (RecPtr >> 32), (uint32) RecPtr)));
+ rpName, LSN_FORMAT_ARGS(RecPtr))));
return RecPtr;
}
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 */
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",
"%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",
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
/* 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);
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;
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;
}
targetRecOff == pageHeaderSize)
{
report_invalid_record(state, "contrecord is requested by %X/%X",
- (uint32) (RecPtr >> 32), (uint32) RecPtr);
+ LSN_FORMAT_ARGS(RecPtr));
goto err;
}
{
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;
}
{
/* 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;
}
{
report_invalid_record(state,
"there is no contrecord flag at %X/%X",
- (uint32) (RecPtr >> 32), (uint32) RecPtr);
+ LSN_FORMAT_ARGS(RecPtr));
goto err;
}
"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;
}
{
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;
}
{
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)
{
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;
}
}
{
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;
}
}
{
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;
}
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;
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;
{
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)
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;
(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;
}
"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;
}
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;
}
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;
}
}
{
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;
}
{
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;
}
}
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;
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;
}
elog(DEBUG3, "switched to timeline %u valid until %X/%X",
state->currTLI,
- (uint32) (state->currTLIValidUntil >> 32),
- (uint32) (state->currTLIValidUntil));
+ LSN_FORMAT_ARGS(state->currTLIValidUntil));
}
}
"%s{ \"Timeline\": %u, \"Start-LSN\": \"%X/%X\", \"End-LSN\": \"%X/%X\" }",
first_wal_range ? "" : ",\n",
entry->tli,
- (uint32) (tl_beginptr >> 32), (uint32) tl_beginptr,
- (uint32) (endptr >> 32), (uint32) endptr);
+ LSN_FORMAT_ARGS(tl_beginptr),
+ LSN_FORMAT_ARGS(endptr));
if (starttli == entry->tli)
{
pq_sendint16(&buf, 2); /* number of columns */
len = snprintf(str, sizeof(str),
- "%X/%X", (uint32) (ptr >> 32), (uint32) ptr);
+ "%X/%X", LSN_FORMAT_ARGS(ptr));
pq_sendint32(&buf, len);
pq_sendbytes(&buf, str, len);
if (options->logical)
appendStringInfoString(&cmd, " LOGICAL");
- appendStringInfo(&cmd, " %X/%X",
- (uint32) (options->startpoint >> 32),
- (uint32) options->startpoint);
+ appendStringInfo(&cmd, " %X/%X", LSN_FORMAT_ARGS(options->startpoint));
/*
* Additional options are different depending on if we are doing logical
* replication.
*/
elog(DEBUG1, "cannot stream from %X/%X, minimum is %X/%X, forwarding",
- (uint32) (start_lsn >> 32), (uint32) start_lsn,
- (uint32) (slot->data.confirmed_flush >> 32),
- (uint32) slot->data.confirmed_flush);
+ LSN_FORMAT_ARGS(start_lsn),
+ LSN_FORMAT_ARGS(slot->data.confirmed_flush));
start_lsn = slot->data.confirmed_flush;
}
(errmsg("starting logical decoding for slot \"%s\"",
NameStr(slot->data.name)),
errdetail("Streaming transactions committing after %X/%X, reading WAL from %X/%X.",
- (uint32) (slot->data.confirmed_flush >> 32),
- (uint32) slot->data.confirmed_flush,
- (uint32) (slot->data.restart_lsn >> 32),
- (uint32) slot->data.restart_lsn)));
+ LSN_FORMAT_ARGS(slot->data.confirmed_flush),
+ LSN_FORMAT_ARGS(slot->data.restart_lsn))));
return ctx;
}
XLogBeginRead(ctx->reader, slot->data.restart_lsn);
elog(DEBUG1, "searching for logical decoding starting point, starting at %X/%X",
- (uint32) (slot->data.restart_lsn >> 32),
- (uint32) slot->data.restart_lsn);
+ LSN_FORMAT_ARGS(slot->data.restart_lsn));
/* Wait for a consistent starting point */
for (;;)
NameStr(state->ctx->slot->data.name),
NameStr(state->ctx->slot->data.plugin),
state->callback_name,
- (uint32) (state->report_location >> 32),
- (uint32) state->report_location);
+ LSN_FORMAT_ARGS(state->report_location));
else
errcontext("slot \"%s\", output plugin \"%s\", in the %s callback",
NameStr(state->ctx->slot->data.name),
SpinLockRelease(&slot->mutex);
elog(DEBUG1, "got new restart lsn %X/%X at %X/%X",
- (uint32) (restart_lsn >> 32), (uint32) restart_lsn,
- (uint32) (current_lsn >> 32), (uint32) current_lsn);
+ LSN_FORMAT_ARGS(restart_lsn),
+ LSN_FORMAT_ARGS(current_lsn));
}
else
{
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",
- (uint32) (restart_lsn >> 32), (uint32) restart_lsn,
- (uint32) (current_lsn >> 32), (uint32) current_lsn,
- (uint32) (candidate_restart_lsn >> 32),
- (uint32) candidate_restart_lsn,
- (uint32) (candidate_restart_valid >> 32),
- (uint32) candidate_restart_valid,
- (uint32) (confirmed_flush >> 32),
- (uint32) confirmed_flush);
+ LSN_FORMAT_ARGS(restart_lsn),
+ LSN_FORMAT_ARGS(current_lsn),
+ LSN_FORMAT_ARGS(candidate_restart_lsn),
+ LSN_FORMAT_ARGS(candidate_restart_valid),
+ LSN_FORMAT_ARGS(confirmed_flush));
}
/* candidates are already valid with the current flush position, apply */
ereport(LOG,
(errmsg("recovered replication state of node %u to %X/%X",
disk_state.roident,
- (uint32) (disk_state.remote_lsn >> 32),
- (uint32) disk_state.remote_lsn)));
+ LSN_FORMAT_ARGS(disk_state.remote_lsn))));
}
/* now check checksum */
snprintf(path, MAXPGPATH, "pg_replslot/%s/xid-%u-lsn-%X-%X.spill",
NameStr(MyReplicationSlot->data.name),
- xid,
- (uint32) (recptr >> 32), (uint32) recptr);
+ xid, LSN_FORMAT_ARGS(recptr));
}
/*
continue;
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
{
ereport(DEBUG1,
(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",
builder->initial_xmin_horizon, running->oldestRunningXid)));
ereport(LOG,
(errmsg("logical decoding found consistent point at %X/%X",
- (uint32) (lsn >> 32), (uint32) lsn),
+ LSN_FORMAT_ARGS(lsn)),
errdetail("There are no running transactions.")));
return false;
ereport(LOG,
(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.",
running->xcnt, running->nextXid)));
ereport(LOG,
(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.",
running->xcnt, running->nextXid)));
ereport(LOG,
(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.")));
}
* no hope continuing to decode anyway.
*/
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
/* to make sure only we will write to this tempfile, include pid */
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
return false;
sprintf(path, "pg_logical/snapshots/%X-%X.snap",
- (uint32) (lsn >> 32), (uint32) lsn);
+ LSN_FORMAT_ARGS(lsn));
fd = OpenTransientFile(path, O_RDONLY | PG_BINARY);
ereport(LOG,
(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.")));
return true;
elog(DEBUG1,
"LogicalRepSyncTableStart: '%s' origin_startpos lsn %X/%X",
- originname,
- (uint32) (*origin_startpos >> 32),
- (uint32) *origin_startpos);
+ originname, LSN_FORMAT_ARGS(*origin_startpos));
/*
* We are done with the initial data synchronization, update the state.
elog(DEBUG2, "sending feedback (force %d) to recv %X/%X, write %X/%X, flush %X/%X",
force,
- (uint32) (recvpos >> 32), (uint32) recvpos,
- (uint32) (writepos >> 32), (uint32) writepos,
- (uint32) (flushpos >> 32), (uint32) flushpos
- );
+ LSN_FORMAT_ARGS(recvpos),
+ LSN_FORMAT_ARGS(writepos),
+ LSN_FORMAT_ARGS(flushpos));
walrcv_send(wrconn, reply_message->data, reply_message->len);
ereport(LOG,
(errmsg("invalidating slot \"%s\" because its restart_lsn %X/%X exceeds max_slot_wal_keep_size",
NameStr(slotname),
- (uint32) (restart_lsn >> 32),
- (uint32) restart_lsn)));
+ LSN_FORMAT_ARGS(restart_lsn))));
SpinLockAcquire(&s->mutex);
s->data.invalidated_at = s->data.restart_lsn;
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("cannot advance replication slot to %X/%X, minimum is %X/%X",
- (uint32) (moveto >> 32), (uint32) moveto,
- (uint32) (minlsn >> 32), (uint32) minlsn)));
+ LSN_FORMAT_ARGS(moveto), LSN_FORMAT_ARGS(minlsn))));
/* Do the actual slot update, depending on the slot type */
if (OidIsValid(MyReplicationSlot->data.database))
new_status = (char *) palloc(len + 32 + 1);
memcpy(new_status, old_status, len);
sprintf(new_status + len, " waiting for %X/%X",
- (uint32) (lsn >> 32), (uint32) lsn);
+ LSN_FORMAT_ARGS(lsn));
set_ps_display(new_status);
new_status[len] = '\0'; /* truncate off " waiting ..." */
}
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",
- numwrite, (uint32) (writePtr >> 32), (uint32) writePtr,
- numflush, (uint32) (flushPtr >> 32), (uint32) flushPtr,
- numapply, (uint32) (applyPtr >> 32), (uint32) applyPtr);
+ numwrite, LSN_FORMAT_ARGS(writePtr),
+ numflush, LSN_FORMAT_ARGS(flushPtr),
+ numapply, LSN_FORMAT_ARGS(applyPtr));
}
/*
if (first_stream)
ereport(LOG,
(errmsg("started streaming WAL from primary at %X/%X on timeline %u",
- (uint32) (startpoint >> 32), (uint32) startpoint,
- startpointTLI)));
+ LSN_FORMAT_ARGS(startpoint), startpointTLI)));
else
ereport(LOG,
(errmsg("restarted WAL streaming at %X/%X on timeline %u",
- (uint32) (startpoint >> 32), (uint32) startpoint,
- startpointTLI)));
+ LSN_FORMAT_ARGS(startpoint), startpointTLI)));
first_stream = false;
/* Initialize LogstreamResult and buffers for processing messages */
(errmsg("replication terminated by primary server"),
errdetail("End of WAL reached on timeline %u at %X/%X.",
startpointTLI,
- (uint32) (LogstreamResult.Write >> 32), (uint32) LogstreamResult.Write)));
+ LSN_FORMAT_ARGS(LogstreamResult.Write))));
endofwal = true;
break;
}
char activitymsg[50];
snprintf(activitymsg, sizeof(activitymsg), "restarting at %X/%X",
- (uint32) (*startpoint >> 32),
- (uint32) *startpoint);
+ LSN_FORMAT_ARGS(*startpoint));
set_ps_display(activitymsg);
}
}
char activitymsg[50];
snprintf(activitymsg, sizeof(activitymsg), "streaming %X/%X",
- (uint32) (LogstreamResult.Write >> 32),
- (uint32) LogstreamResult.Write);
+ LSN_FORMAT_ARGS(LogstreamResult.Write));
set_ps_display(activitymsg);
}
/* Send it */
elog(DEBUG2, "sending write %X/%X flush %X/%X apply %X/%X%s",
- (uint32) (writePtr >> 32), (uint32) writePtr,
- (uint32) (flushPtr >> 32), (uint32) flushPtr,
- (uint32) (applyPtr >> 32), (uint32) applyPtr,
+ LSN_FORMAT_ARGS(writePtr),
+ LSN_FORMAT_ARGS(flushPtr),
+ LSN_FORMAT_ARGS(applyPtr),
requestReply ? " (reply requested)" : "");
walrcv_send(wrconn, reply_message.data, reply_message.len);
else
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)
{
{
ereport(ERROR,
(errmsg("requested starting point %X/%X on timeline %u is not in this server's history",
- (uint32) (cmd->startpoint >> 32),
- (uint32) (cmd->startpoint),
+ LSN_FORMAT_ARGS(cmd->startpoint),
cmd->timeline),
errdetail("This server's history forked from timeline %u at %X/%X.",
cmd->timeline,
- (uint32) (switchpoint >> 32),
- (uint32) (switchpoint))));
+ LSN_FORMAT_ARGS(switchpoint))));
}
sendTimeLineValidUpto = switchpoint;
}
{
ereport(ERROR,
(errmsg("requested starting point %X/%X is ahead of the WAL flush position of this server %X/%X",
- (uint32) (cmd->startpoint >> 32),
- (uint32) (cmd->startpoint),
- (uint32) (FlushPtr >> 32),
- (uint32) (FlushPtr))));
+ LSN_FORMAT_ARGS(cmd->startpoint),
+ LSN_FORMAT_ARGS(FlushPtr))));
}
/* Start streaming from the requested point */
bool nulls[2];
snprintf(startpos_str, sizeof(startpos_str), "%X/%X",
- (uint32) (sendTimeLineValidUpto >> 32),
- (uint32) sendTimeLineValidUpto);
+ LSN_FORMAT_ARGS(sendTimeLineValidUpto));
dest = CreateDestReceiver(DestRemoteSimple);
MemSet(nulls, false, sizeof(nulls));
}
snprintf(xloc, sizeof(xloc), "%X/%X",
- (uint32) (MyReplicationSlot->data.confirmed_flush >> 32),
- (uint32) MyReplicationSlot->data.confirmed_flush);
+ LSN_FORMAT_ARGS(MyReplicationSlot->data.confirmed_flush));
dest = CreateDestReceiver(DestRemoteSimple);
MemSet(nulls, false, sizeof(nulls));
replyTimeStr = pstrdup(timestamptz_to_str(replyTime));
elog(DEBUG2, "write %X/%X flush %X/%X apply %X/%X%s reply_time %s",
- (uint32) (writePtr >> 32), (uint32) writePtr,
- (uint32) (flushPtr >> 32), (uint32) flushPtr,
- (uint32) (applyPtr >> 32), (uint32) applyPtr,
+ LSN_FORMAT_ARGS(writePtr),
+ LSN_FORMAT_ARGS(flushPtr),
+ LSN_FORMAT_ARGS(applyPtr),
replyRequested ? " (reply requested)" : "",
replyTimeStr);
WalSndCaughtUp = true;
elog(DEBUG1, "walsender reached end of timeline at %X/%X (sent up to %X/%X)",
- (uint32) (sendTimeLineValidUpto >> 32), (uint32) sendTimeLineValidUpto,
- (uint32) (sentPtr >> 32), (uint32) sentPtr);
+ LSN_FORMAT_ARGS(sendTimeLineValidUpto),
+ LSN_FORMAT_ARGS(sentPtr));
return;
}
char activitymsg[50];
snprintf(activitymsg, sizeof(activitymsg), "streaming %X/%X",
- (uint32) (sentPtr >> 32), (uint32) sentPtr);
+ LSN_FORMAT_ARGS(sentPtr));
set_ps_display(activitymsg);
}
}
elog(trace_recovery(DEBUG2),
"snapshot of %u running transactions overflowed (lsn %X/%X oldest xid %u latest complete %u next xid %u)",
CurrRunningXacts->xcnt,
- (uint32) (recptr >> 32), (uint32) recptr,
+ LSN_FORMAT_ARGS(recptr),
CurrRunningXacts->oldestRunningXid,
CurrRunningXacts->latestCompletedXid,
CurrRunningXacts->nextXid);
elog(trace_recovery(DEBUG2),
"snapshot of %u+%u running transaction ids (lsn %X/%X oldest xid %u latest complete %u next xid %u)",
CurrRunningXacts->xcnt, CurrRunningXacts->subxcnt,
- (uint32) (recptr >> 32), (uint32) recptr,
+ LSN_FORMAT_ARGS(recptr),
CurrRunningXacts->oldestRunningXid,
CurrRunningXacts->latestCompletedXid,
CurrRunningXacts->nextXid);
XLogRecPtr lsn = PG_GETARG_LSN(0);
char buf[MAXPG_LSNLEN + 1];
char *result;
- uint32 id,
- off;
-
- /* Decode ID and offset */
- id = (uint32) (lsn >> 32);
- off = (uint32) lsn;
- snprintf(buf, sizeof buf, "%X/%X", id, off);
+ snprintf(buf, sizeof buf, "%X/%X", LSN_FORMAT_ARGS(lsn));
result = pstrdup(buf);
PG_RETURN_CSTRING(result);
}
/* we assume that we get called once at the end of each segment */
if (verbose && segment_finished)
pg_log_info("finished segment at %X/%X (timeline %u)",
- (uint32) (xlogpos >> 32), (uint32) xlogpos,
+ LSN_FORMAT_ARGS(xlogpos),
timeline);
if (!XLogRecPtrIsInvalid(endpos) && endpos < xlogpos)
{
if (verbose)
pg_log_info("stopped log streaming at %X/%X (timeline %u)",
- (uint32) (xlogpos >> 32), (uint32) xlogpos,
+ LSN_FORMAT_ARGS(xlogpos),
timeline);
time_to_stop = true;
return true;
if (verbose && prevtimeline != 0 && prevtimeline != timeline)
pg_log_info("switched to timeline %u at %X/%X",
timeline,
- (uint32) (prevpos >> 32), (uint32) prevpos);
+ LSN_FORMAT_ARGS(prevpos));
prevtimeline = timeline;
prevpos = xlogpos;
*/
if (verbose)
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.stream_stop = stop_streaming;
if (verbose)
pg_log_info("confirming write up to %X/%X, flush to %X/%X (slot %s)",
- (uint32) (output_written_lsn >> 32), (uint32) output_written_lsn,
- (uint32) (output_fsync_lsn >> 32), (uint32) output_fsync_lsn,
+ LSN_FORMAT_ARGS(output_written_lsn),
+ LSN_FORMAT_ARGS(output_fsync_lsn),
replication_slot);
replybuf[len] = 'r';
*/
if (verbose)
pg_log_info("starting log streaming at %X/%X (slot %s)",
- (uint32) (startpos >> 32), (uint32) startpos,
+ LSN_FORMAT_ARGS(startpos),
replication_slot);
/* Initiate the replication stream at specified location */
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 */
if (noptions)
{
if (keepalive)
pg_log_info("end position %X/%X reached by keepalive",
- (uint32) (endpos >> 32), (uint32) endpos);
+ LSN_FORMAT_ARGS(endpos));
else
pg_log_info("end position %X/%X reached by WAL record at %X/%X",
- (uint32) (endpos >> 32), (uint32) (endpos),
- (uint32) (lsn >> 32), (uint32) lsn);
+ LSN_FORMAT_ARGS(endpos), LSN_FORMAT_ARGS(lsn));
}
}
/* Initiate the replication stream at specified location */
snprintf(query, sizeof(query), "START_REPLICATION %s%X/%X TIMELINE %u",
slotcmd,
- (uint32) (stream->startpos >> 32), (uint32) stream->startpos,
+ LSN_FORMAT_ARGS(stream->startpos),
stream->timeline);
res = PQexec(conn, query);
if (PQresultStatus(res) != PGRES_COPY_BOTH)
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",
- stream->timeline, (uint32) (stoppos >> 32), (uint32) stoppos,
- newtimeline, (uint32) (stream->startpos >> 32), (uint32) stream->startpos);
+ stream->timeline, LSN_FORMAT_ARGS(stoppos),
+ newtimeline, LSN_FORMAT_ARGS(stream->startpos));
goto error;
}
printf(_("pg_control last modified: %s\n"),
pgctime_str);
printf(_("Latest checkpoint location: %X/%X\n"),
- (uint32) (ControlFile->checkPoint >> 32),
- (uint32) ControlFile->checkPoint);
+ LSN_FORMAT_ARGS(ControlFile->checkPoint));
printf(_("Latest checkpoint's REDO location: %X/%X\n"),
- (uint32) (ControlFile->checkPointCopy.redo >> 32),
- (uint32) ControlFile->checkPointCopy.redo);
+ LSN_FORMAT_ARGS(ControlFile->checkPointCopy.redo));
printf(_("Latest checkpoint's REDO WAL file: %s\n"),
xlogfilename);
printf(_("Latest checkpoint's TimeLineID: %u\n"),
printf(_("Time of latest checkpoint: %s\n"),
ckpttime_str);
printf(_("Fake LSN counter for unlogged rels: %X/%X\n"),
- (uint32) (ControlFile->unloggedLSN >> 32),
- (uint32) ControlFile->unloggedLSN);
+ LSN_FORMAT_ARGS(ControlFile->unloggedLSN));
printf(_("Minimum recovery ending location: %X/%X\n"),
- (uint32) (ControlFile->minRecoveryPoint >> 32),
- (uint32) ControlFile->minRecoveryPoint);
+ LSN_FORMAT_ARGS(ControlFile->minRecoveryPoint));
printf(_("Min recovery ending loc's timeline: %u\n"),
ControlFile->minRecoveryPointTLI);
printf(_("Backup start location: %X/%X\n"),
- (uint32) (ControlFile->backupStartPoint >> 32),
- (uint32) ControlFile->backupStartPoint);
+ LSN_FORMAT_ARGS(ControlFile->backupStartPoint));
printf(_("Backup end location: %X/%X\n"),
- (uint32) (ControlFile->backupEndPoint >> 32),
- (uint32) ControlFile->backupEndPoint);
+ LSN_FORMAT_ARGS(ControlFile->backupEndPoint));
printf(_("End-of-backup record required: %s\n"),
ControlFile->backupEndRequired ? _("yes") : _("no"));
printf(_("wal_level setting: %s\n"),
if (errormsg)
pg_fatal("could not read WAL record at %X/%X: %s",
- (uint32) (errptr >> 32), (uint32) (errptr),
+ LSN_FORMAT_ARGS(errptr),
errormsg);
else
pg_fatal("could not read WAL record at %X/%X",
- (uint32) (errptr >> 32), (uint32) (errptr));
+ LSN_FORMAT_ARGS(errptr));
}
extractPageInfo(xlogreader);
{
if (errormsg)
pg_fatal("could not read WAL record at %X/%X: %s",
- (uint32) (ptr >> 32), (uint32) (ptr), errormsg);
+ LSN_FORMAT_ARGS(ptr), errormsg);
else
pg_fatal("could not read WAL record at %X/%X",
- (uint32) (ptr >> 32), (uint32) (ptr));
+ LSN_FORMAT_ARGS(ptr));
}
endptr = xlogreader->EndRecPtr;
{
if (errormsg)
pg_fatal("could not find previous WAL record at %X/%X: %s",
- (uint32) (searchptr >> 32), (uint32) (searchptr),
+ LSN_FORMAT_ARGS(searchptr),
errormsg);
else
pg_fatal("could not find previous WAL record at %X/%X",
- (uint32) (searchptr >> 32), (uint32) (searchptr));
+ LSN_FORMAT_ARGS(searchptr));
}
/*
*/
pg_fatal("WAL record modifies a relation, but record type is not recognized: "
"lsn: %X/%X, rmgr: %s, info: %02X",
- (uint32) (record->ReadRecPtr >> 32), (uint32) (record->ReadRecPtr),
+ LSN_FORMAT_ARGS(record->ReadRecPtr),
RmgrNames[rmid], info);
}
findCommonAncestorTimeline(&divergerec, &lastcommontliIndex);
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);
/*
findLastCheckpoint(datadir_target, divergerec, lastcommontliIndex,
&chkptrec, &chkpttli, &chkptredo, restore_command);
pg_log_info("rewinding from last common checkpoint at %X/%X on timeline %u",
- (uint32) (chkptrec >> 32), (uint32) chkptrec,
- chkpttli);
+ LSN_FORMAT_ARGS(chkptrec), chkpttli);
/* Initialize the hash table to track the status of each file */
filehash_init();
entry = &history[i];
pg_log_debug("%d: %X/%X - %X/%X", entry->tli,
- (uint32) (entry->begin >> 32), (uint32) (entry->begin),
- (uint32) (entry->end >> 32), (uint32) (entry->end));
+ LSN_FORMAT_ARGS(entry->begin),
+ LSN_FORMAT_ARGS(entry->end));
}
}
"BACKUP FROM: standby\n"
"START TIME: %s\n",
/* omit LABEL: line */
- (uint32) (startpoint >> 32), (uint32) startpoint, xlogfilename,
- (uint32) (checkpointloc >> 32), (uint32) checkpointloc,
+ LSN_FORMAT_ARGS(startpoint), xlogfilename,
+ LSN_FORMAT_ARGS(checkpointloc),
strfbuf);
if (len >= sizeof(buf))
pg_fatal("backup label buffer too small"); /* shouldn't happen */
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,
- (uint32) (this_wal_range->start_lsn >> 32),
- (uint32) this_wal_range->start_lsn,
- (uint32) (this_wal_range->end_lsn >> 32),
- (uint32) this_wal_range->end_lsn);
+ LSN_FORMAT_ARGS(this_wal_range->start_lsn),
+ LSN_FORMAT_ARGS(this_wal_range->end_lsn));
if (system(pg_waldump_cmd) != 0)
report_backup_error(context,
"WAL parsing failed for timeline %u",
desc->rm_name,
rec_len, XLogRecGetTotalLen(record),
XLogRecGetXid(record),
- (uint32) (record->ReadRecPtr >> 32), (uint32) record->ReadRecPtr,
- (uint32) (xl_prev >> 32), (uint32) xl_prev);
+ LSN_FORMAT_ARGS(record->ReadRecPtr),
+ LSN_FORMAT_ARGS(xl_prev));
id = desc->rm_identify(info);
if (id == NULL)
else if (!XLByteInSeg(private.startptr, segno, WalSegSz))
{
pg_log_error("start WAL location %X/%X is not inside file \"%s\"",
- (uint32) (private.startptr >> 32),
- (uint32) private.startptr,
+ LSN_FORMAT_ARGS(private.startptr),
fname);
goto bad_argument;
}
private.endptr != (segno + 1) * WalSegSz)
{
pg_log_error("end WAL location %X/%X is not inside file \"%s\"",
- (uint32) (private.endptr >> 32),
- (uint32) private.endptr,
+ LSN_FORMAT_ARGS(private.endptr),
argv[argc - 1]);
goto bad_argument;
}
if (first_record == InvalidXLogRecPtr)
fatal_error("could not find a valid record after %X/%X",
- (uint32) (private.startptr >> 32),
- (uint32) private.startptr);
+ LSN_FORMAT_ARGS(private.startptr));
/*
* Display a message that we're skipping data if `from` wasn't a pointer
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 - private.startptr)),
- (uint32) (private.startptr >> 32), (uint32) private.startptr,
- (uint32) (first_record >> 32), (uint32) first_record,
+ LSN_FORMAT_ARGS(private.startptr),
+ LSN_FORMAT_ARGS(first_record),
(uint32) (first_record - private.startptr));
for (;;)
if (errormsg)
fatal_error("error in WAL record at %X/%X: %s",
- (uint32) (xlogreader_state->ReadRecPtr >> 32),
- (uint32) xlogreader_state->ReadRecPtr,
+ LSN_FORMAT_ARGS(xlogreader_state->ReadRecPtr),
errormsg);
XLogReaderFree(xlogreader_state);
*/
#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.
*/