mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Standardize LSN formatting by zero padding
This commit standardizes the output format for LSNs to ensure consistent representation across various tools and messages. Previously, LSNs were inconsistently printed as `%X/%X` in some contexts, while others used zero-padding. This often led to confusion when comparing. To address this, the LSN format is now uniformly set to `%X/%08X`, ensuring the lower 32-bit part is always zero-padded to eight hexadecimal digits. Author: Japin Li <japinli@hotmail.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de> Discussion: https://postgr.es/m/ME0P300MB0445CA53CA0E4B8C1879AF84B641A@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM
This commit is contained in:
@@ -29,7 +29,7 @@ replorigin_desc(StringInfo buf, XLogReaderState *record)
|
||||
|
||||
xlrec = (xl_replorigin_set *) rec;
|
||||
|
||||
appendStringInfo(buf, "set %u; lsn %X/%X; force: %d",
|
||||
appendStringInfo(buf, "set %u; lsn %X/%08X; force: %d",
|
||||
xlrec->node_id,
|
||||
LSN_FORMAT_ARGS(xlrec->remote_lsn),
|
||||
xlrec->force);
|
||||
|
||||
@@ -359,7 +359,7 @@ xact_desc_commit(StringInfo buf, uint8 info, xl_xact_commit *xlrec, RepOriginId
|
||||
|
||||
if (parsed.xinfo & XACT_XINFO_HAS_ORIGIN)
|
||||
{
|
||||
appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s",
|
||||
appendStringInfo(buf, "; origin: node %u, lsn %X/%08X, at %s",
|
||||
origin_id,
|
||||
LSN_FORMAT_ARGS(parsed.origin_lsn),
|
||||
timestamptz_to_str(parsed.origin_timestamp));
|
||||
@@ -384,7 +384,7 @@ xact_desc_abort(StringInfo buf, uint8 info, xl_xact_abort *xlrec, RepOriginId or
|
||||
|
||||
if (parsed.xinfo & XACT_XINFO_HAS_ORIGIN)
|
||||
{
|
||||
appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s",
|
||||
appendStringInfo(buf, "; origin: node %u, lsn %X/%08X, at %s",
|
||||
origin_id,
|
||||
LSN_FORMAT_ARGS(parsed.origin_lsn),
|
||||
timestamptz_to_str(parsed.origin_timestamp));
|
||||
@@ -418,7 +418,7 @@ xact_desc_prepare(StringInfo buf, uint8 info, xl_xact_prepare *xlrec, RepOriginI
|
||||
* way as PrepareRedoAdd().
|
||||
*/
|
||||
if (origin_id != InvalidRepOriginId)
|
||||
appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s",
|
||||
appendStringInfo(buf, "; origin: node %u, lsn %X/%08X, at %s",
|
||||
origin_id,
|
||||
LSN_FORMAT_ARGS(parsed.origin_lsn),
|
||||
timestamptz_to_str(parsed.origin_timestamp));
|
||||
|
||||
@@ -65,7 +65,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
|
||||
{
|
||||
CheckPoint *checkpoint = (CheckPoint *) rec;
|
||||
|
||||
appendStringInfo(buf, "redo %X/%X; "
|
||||
appendStringInfo(buf, "redo %X/%08X; "
|
||||
"tli %u; prev tli %u; fpw %s; wal_level %s; xid %u:%u; oid %u; multi %u; offset %u; "
|
||||
"oldest xid %u in DB %u; oldest multi %u in DB %u; "
|
||||
"oldest/newest commit timestamp xid: %u/%u; "
|
||||
@@ -111,7 +111,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
|
||||
XLogRecPtr startpoint;
|
||||
|
||||
memcpy(&startpoint, rec, sizeof(XLogRecPtr));
|
||||
appendStringInfo(buf, "%X/%X", LSN_FORMAT_ARGS(startpoint));
|
||||
appendStringInfo(buf, "%X/%08X", LSN_FORMAT_ARGS(startpoint));
|
||||
}
|
||||
else if (info == XLOG_PARAMETER_CHANGE)
|
||||
{
|
||||
@@ -156,7 +156,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
|
||||
xl_overwrite_contrecord xlrec;
|
||||
|
||||
memcpy(&xlrec, rec, sizeof(xl_overwrite_contrecord));
|
||||
appendStringInfo(buf, "lsn %X/%X; time %s",
|
||||
appendStringInfo(buf, "lsn %X/%08X; time %s",
|
||||
LSN_FORMAT_ARGS(xlrec.overwritten_lsn),
|
||||
timestamptz_to_str(xlrec.overwrite_time));
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ readTimeLineHistory(TimeLineID targetTLI)
|
||||
if (*ptr == '\0' || *ptr == '#')
|
||||
continue;
|
||||
|
||||
nfields = sscanf(fline, "%u\t%X/%X", &tli, &switchpoint_hi, &switchpoint_lo);
|
||||
nfields = sscanf(fline, "%u\t%X/%08X", &tli, &switchpoint_hi, &switchpoint_lo);
|
||||
|
||||
if (nfields < 1)
|
||||
{
|
||||
@@ -399,7 +399,7 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI,
|
||||
* parent file failed to end with one.
|
||||
*/
|
||||
snprintf(buffer, sizeof(buffer),
|
||||
"%s%u\t%X/%X\t%s\n",
|
||||
"%s%u\t%X/%08X\t%s\n",
|
||||
(srcfd < 0) ? "" : "\n",
|
||||
parentTLI,
|
||||
LSN_FORMAT_ARGS(switchpoint),
|
||||
|
||||
@@ -1429,12 +1429,12 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len)
|
||||
if (errormsg)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not read two-phase state from WAL at %X/%X: %s",
|
||||
errmsg("could not read two-phase state from WAL at %X/%08X: %s",
|
||||
LSN_FORMAT_ARGS(lsn), errormsg)));
|
||||
else
|
||||
ereport(ERROR,
|
||||
(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/%08X",
|
||||
LSN_FORMAT_ARGS(lsn))));
|
||||
}
|
||||
|
||||
@@ -1442,7 +1442,7 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len)
|
||||
(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",
|
||||
errmsg("expected two-phase state data is not present in WAL at %X/%08X",
|
||||
LSN_FORMAT_ARGS(lsn))));
|
||||
|
||||
if (len != NULL)
|
||||
@@ -2533,7 +2533,7 @@ PrepareRedoAdd(FullTransactionId fxid, char *buf,
|
||||
ereport(reachedConsistency ? ERROR : WARNING,
|
||||
(errmsg("could not recover two-phase state file for transaction %u",
|
||||
hdr->xid),
|
||||
errdetail("Two-phase state file has been found in WAL record %X/%X, but this transaction has already been restored from disk.",
|
||||
errdetail("Two-phase state file has been found in WAL record %X/%08X, but this transaction has already been restored from disk.",
|
||||
LSN_FORMAT_ARGS(start_lsn))));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1028,7 +1028,7 @@ XLogInsertRecord(XLogRecData *rdata,
|
||||
oldCxt = MemoryContextSwitchTo(walDebugCxt);
|
||||
|
||||
initStringInfo(&buf);
|
||||
appendStringInfo(&buf, "INSERT @ %X/%X: ", LSN_FORMAT_ARGS(EndPos));
|
||||
appendStringInfo(&buf, "INSERT @ %X/%08X: ", LSN_FORMAT_ARGS(EndPos));
|
||||
|
||||
/*
|
||||
* We have to piece together the WAL record data from the XLogRecData
|
||||
@@ -1549,8 +1549,8 @@ WaitXLogInsertionsToFinish(XLogRecPtr upto)
|
||||
if (upto > reservedUpto)
|
||||
{
|
||||
ereport(LOG,
|
||||
(errmsg("request to flush past end of generated WAL; request %X/%X, current position %X/%X",
|
||||
LSN_FORMAT_ARGS(upto), LSN_FORMAT_ARGS(reservedUpto))));
|
||||
errmsg("request to flush past end of generated WAL; request %X/%08X, current position %X/%08X",
|
||||
LSN_FORMAT_ARGS(upto), LSN_FORMAT_ARGS(reservedUpto)));
|
||||
upto = reservedUpto;
|
||||
}
|
||||
|
||||
@@ -1716,7 +1716,7 @@ GetXLogBuffer(XLogRecPtr ptr, TimeLineID tli)
|
||||
endptr = pg_atomic_read_u64(&XLogCtl->xlblocks[idx]);
|
||||
|
||||
if (expectedEndPtr != endptr)
|
||||
elog(PANIC, "could not find WAL buffer for %X/%X",
|
||||
elog(PANIC, "could not find WAL buffer for %X/%08X",
|
||||
LSN_FORMAT_ARGS(ptr));
|
||||
}
|
||||
else
|
||||
@@ -1776,7 +1776,7 @@ WALReadFromBuffers(char *dstbuf, XLogRecPtr startptr, Size count,
|
||||
inserted = pg_atomic_read_u64(&XLogCtl->logInsertResult);
|
||||
if (startptr + count > inserted)
|
||||
ereport(ERROR,
|
||||
errmsg("cannot read past end of generated WAL: requested %X/%X, current position %X/%X",
|
||||
errmsg("cannot read past end of generated WAL: requested %X/%08X, current position %X/%08X",
|
||||
LSN_FORMAT_ARGS(startptr + count),
|
||||
LSN_FORMAT_ARGS(inserted)));
|
||||
|
||||
@@ -2281,7 +2281,7 @@ AdvanceXLInsertBuffer(XLogRecPtr upto, TimeLineID tli, bool opportunistic)
|
||||
#ifdef WAL_DEBUG
|
||||
if (XLOG_DEBUG && npages > 0)
|
||||
{
|
||||
elog(DEBUG1, "initialized %d pages, up to %X/%X",
|
||||
elog(DEBUG1, "initialized %d pages, up to %X/%08X",
|
||||
npages, LSN_FORMAT_ARGS(NewPageEndPtr));
|
||||
}
|
||||
#endif
|
||||
@@ -2492,7 +2492,7 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible)
|
||||
XLogRecPtr EndPtr = pg_atomic_read_u64(&XLogCtl->xlblocks[curridx]);
|
||||
|
||||
if (LogwrtResult.Write >= EndPtr)
|
||||
elog(PANIC, "xlog write request %X/%X is past end of log %X/%X",
|
||||
elog(PANIC, "xlog write request %X/%08X is past end of log %X/%08X",
|
||||
LSN_FORMAT_ARGS(LogwrtResult.Write),
|
||||
LSN_FORMAT_ARGS(EndPtr));
|
||||
|
||||
@@ -2892,7 +2892,7 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
|
||||
newMinRecoveryPoint = GetCurrentReplayRecPtr(&newMinRecoveryPointTLI);
|
||||
if (!force && newMinRecoveryPoint < lsn)
|
||||
elog(WARNING,
|
||||
"xlog min recovery request %X/%X is past current point %X/%X",
|
||||
"xlog min recovery request %X/%08X is past current point %X/%08X",
|
||||
LSN_FORMAT_ARGS(lsn), LSN_FORMAT_ARGS(newMinRecoveryPoint));
|
||||
|
||||
/* update control file */
|
||||
@@ -2905,9 +2905,9 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
|
||||
LocalMinRecoveryPointTLI = newMinRecoveryPointTLI;
|
||||
|
||||
ereport(DEBUG2,
|
||||
(errmsg_internal("updated min recovery point to %X/%X on timeline %u",
|
||||
LSN_FORMAT_ARGS(newMinRecoveryPoint),
|
||||
newMinRecoveryPointTLI)));
|
||||
errmsg_internal("updated min recovery point to %X/%08X on timeline %u",
|
||||
LSN_FORMAT_ARGS(newMinRecoveryPoint),
|
||||
newMinRecoveryPointTLI));
|
||||
}
|
||||
}
|
||||
LWLockRelease(ControlFileLock);
|
||||
@@ -2945,7 +2945,7 @@ XLogFlush(XLogRecPtr record)
|
||||
|
||||
#ifdef WAL_DEBUG
|
||||
if (XLOG_DEBUG)
|
||||
elog(LOG, "xlog flush request %X/%X; write %X/%X; flush %X/%X",
|
||||
elog(LOG, "xlog flush request %X/%08X; write %X/%08X; flush %X/%08X",
|
||||
LSN_FORMAT_ARGS(record),
|
||||
LSN_FORMAT_ARGS(LogwrtResult.Write),
|
||||
LSN_FORMAT_ARGS(LogwrtResult.Flush));
|
||||
@@ -3078,7 +3078,7 @@ XLogFlush(XLogRecPtr record)
|
||||
*/
|
||||
if (LogwrtResult.Flush < record)
|
||||
elog(ERROR,
|
||||
"xlog flush request %X/%X is not satisfied --- flushed only to %X/%X",
|
||||
"xlog flush request %X/%08X is not satisfied --- flushed only to %X/%08X",
|
||||
LSN_FORMAT_ARGS(record),
|
||||
LSN_FORMAT_ARGS(LogwrtResult.Flush));
|
||||
}
|
||||
@@ -3205,7 +3205,7 @@ XLogBackgroundFlush(void)
|
||||
|
||||
#ifdef WAL_DEBUG
|
||||
if (XLOG_DEBUG)
|
||||
elog(LOG, "xlog bg flush request write %X/%X; flush: %X/%X, current is write %X/%X; flush %X/%X",
|
||||
elog(LOG, "xlog bg flush request write %X/%08X; flush: %X/%08X, current is write %X/%08X; flush %X/%08X",
|
||||
LSN_FORMAT_ARGS(WriteRqst.Write),
|
||||
LSN_FORMAT_ARGS(WriteRqst.Flush),
|
||||
LSN_FORMAT_ARGS(LogwrtResult.Write),
|
||||
@@ -6921,7 +6921,7 @@ LogCheckpointEnd(bool restartpoint)
|
||||
"%d removed, %d recycled; write=%ld.%03d s, "
|
||||
"sync=%ld.%03d s, total=%ld.%03d s; sync files=%d, "
|
||||
"longest=%ld.%03d s, average=%ld.%03d s; distance=%d kB, "
|
||||
"estimate=%d kB; lsn=%X/%X, redo lsn=%X/%X",
|
||||
"estimate=%d kB; lsn=%X/%08X, redo lsn=%X/%08X",
|
||||
CheckpointStats.ckpt_bufs_written,
|
||||
(double) CheckpointStats.ckpt_bufs_written * 100 / NBuffers,
|
||||
CheckpointStats.ckpt_slru_written,
|
||||
@@ -6945,7 +6945,7 @@ LogCheckpointEnd(bool restartpoint)
|
||||
"%d removed, %d recycled; write=%ld.%03d s, "
|
||||
"sync=%ld.%03d s, total=%ld.%03d s; sync files=%d, "
|
||||
"longest=%ld.%03d s, average=%ld.%03d s; distance=%d kB, "
|
||||
"estimate=%d kB; lsn=%X/%X, redo lsn=%X/%X",
|
||||
"estimate=%d kB; lsn=%X/%08X, redo lsn=%X/%08X",
|
||||
CheckpointStats.ckpt_bufs_written,
|
||||
(double) CheckpointStats.ckpt_bufs_written * 100 / NBuffers,
|
||||
CheckpointStats.ckpt_slru_written,
|
||||
@@ -7641,7 +7641,7 @@ CreateOverwriteContrecordRecord(XLogRecPtr aborted_lsn, XLogRecPtr pagePtr,
|
||||
if (!RecoveryInProgress())
|
||||
elog(ERROR, "can only be used at end of recovery");
|
||||
if (pagePtr % XLOG_BLCKSZ != 0)
|
||||
elog(ERROR, "invalid position for missing continuation record %X/%X",
|
||||
elog(ERROR, "invalid position for missing continuation record %X/%08X",
|
||||
LSN_FORMAT_ARGS(pagePtr));
|
||||
|
||||
/* The current WAL insert position should be right after the page header */
|
||||
@@ -7652,7 +7652,7 @@ CreateOverwriteContrecordRecord(XLogRecPtr aborted_lsn, XLogRecPtr pagePtr,
|
||||
startPos += SizeOfXLogShortPHD;
|
||||
recptr = GetXLogInsertRecPtr();
|
||||
if (recptr != startPos)
|
||||
elog(ERROR, "invalid WAL insert position %X/%X for OVERWRITE_CONTRECORD",
|
||||
elog(ERROR, "invalid WAL insert position %X/%08X for OVERWRITE_CONTRECORD",
|
||||
LSN_FORMAT_ARGS(recptr));
|
||||
|
||||
START_CRIT_SECTION();
|
||||
@@ -7682,7 +7682,7 @@ CreateOverwriteContrecordRecord(XLogRecPtr aborted_lsn, XLogRecPtr pagePtr,
|
||||
|
||||
/* check that the record was inserted to the right place */
|
||||
if (ProcLastRecPtr != startPos)
|
||||
elog(ERROR, "OVERWRITE_CONTRECORD was inserted to unexpected position %X/%X",
|
||||
elog(ERROR, "OVERWRITE_CONTRECORD was inserted to unexpected position %X/%08X",
|
||||
LSN_FORMAT_ARGS(ProcLastRecPtr));
|
||||
|
||||
XLogFlush(recptr);
|
||||
@@ -7751,8 +7751,7 @@ RecoveryRestartPoint(const CheckPoint *checkPoint, XLogReaderState *record)
|
||||
if (XLogHaveInvalidPages())
|
||||
{
|
||||
elog(DEBUG2,
|
||||
"could not record restart point at %X/%X because there "
|
||||
"are unresolved references to invalid pages",
|
||||
"could not record restart point at %X/%08X because there are unresolved references to invalid pages",
|
||||
LSN_FORMAT_ARGS(checkPoint->redo));
|
||||
return;
|
||||
}
|
||||
@@ -7832,8 +7831,8 @@ CreateRestartPoint(int flags)
|
||||
lastCheckPoint.redo <= ControlFile->checkPointCopy.redo)
|
||||
{
|
||||
ereport(DEBUG2,
|
||||
(errmsg_internal("skipping restartpoint, already performed at %X/%X",
|
||||
LSN_FORMAT_ARGS(lastCheckPoint.redo))));
|
||||
errmsg_internal("skipping restartpoint, already performed at %X/%08X",
|
||||
LSN_FORMAT_ARGS(lastCheckPoint.redo)));
|
||||
|
||||
UpdateMinRecoveryPoint(InvalidXLogRecPtr, true);
|
||||
if (flags & CHECKPOINT_IS_SHUTDOWN)
|
||||
@@ -8017,10 +8016,10 @@ CreateRestartPoint(int flags)
|
||||
|
||||
xtime = GetLatestXTime();
|
||||
ereport((log_checkpoints ? LOG : DEBUG2),
|
||||
(errmsg("recovery restart point at %X/%X",
|
||||
LSN_FORMAT_ARGS(lastCheckPoint.redo)),
|
||||
xtime ? errdetail("Last completed transaction was at log time %s.",
|
||||
timestamptz_to_str(xtime)) : 0));
|
||||
errmsg("recovery restart point at %X/%08X",
|
||||
LSN_FORMAT_ARGS(lastCheckPoint.redo)),
|
||||
xtime ? errdetail("Last completed transaction was at log time %s.",
|
||||
timestamptz_to_str(xtime)) : 0);
|
||||
|
||||
/*
|
||||
* Finally, execute archive_cleanup_command, if any.
|
||||
@@ -8281,8 +8280,8 @@ XLogRestorePoint(const char *rpName)
|
||||
RecPtr = XLogInsert(RM_XLOG_ID, XLOG_RESTORE_POINT);
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg("restore point \"%s\" created at %X/%X",
|
||||
rpName, LSN_FORMAT_ARGS(RecPtr))));
|
||||
errmsg("restore point \"%s\" created at %X/%08X",
|
||||
rpName, LSN_FORMAT_ARGS(RecPtr)));
|
||||
|
||||
return RecPtr;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ build_backup_content(BackupState *state, bool ishistoryfile)
|
||||
|
||||
XLByteToSeg(state->startpoint, startsegno, wal_segment_size);
|
||||
XLogFileName(startxlogfile, state->starttli, startsegno, wal_segment_size);
|
||||
appendStringInfo(result, "START WAL LOCATION: %X/%X (file %s)\n",
|
||||
appendStringInfo(result, "START WAL LOCATION: %X/%08X (file %s)\n",
|
||||
LSN_FORMAT_ARGS(state->startpoint), startxlogfile);
|
||||
|
||||
if (ishistoryfile)
|
||||
@@ -52,11 +52,11 @@ build_backup_content(BackupState *state, bool ishistoryfile)
|
||||
|
||||
XLByteToSeg(state->stoppoint, stopsegno, wal_segment_size);
|
||||
XLogFileName(stopxlogfile, state->stoptli, stopsegno, wal_segment_size);
|
||||
appendStringInfo(result, "STOP WAL LOCATION: %X/%X (file %s)\n",
|
||||
appendStringInfo(result, "STOP WAL LOCATION: %X/%08X (file %s)\n",
|
||||
LSN_FORMAT_ARGS(state->stoppoint), stopxlogfile);
|
||||
}
|
||||
|
||||
appendStringInfo(result, "CHECKPOINT LOCATION: %X/%X\n",
|
||||
appendStringInfo(result, "CHECKPOINT LOCATION: %X/%08X\n",
|
||||
LSN_FORMAT_ARGS(state->checkpointloc));
|
||||
appendStringInfoString(result, "BACKUP METHOD: streamed\n");
|
||||
appendStringInfo(result, "BACKUP FROM: %s\n",
|
||||
@@ -81,7 +81,7 @@ build_backup_content(BackupState *state, bool ishistoryfile)
|
||||
Assert(XLogRecPtrIsInvalid(state->istartpoint) == (state->istarttli == 0));
|
||||
if (!XLogRecPtrIsInvalid(state->istartpoint))
|
||||
{
|
||||
appendStringInfo(result, "INCREMENTAL FROM LSN: %X/%X\n",
|
||||
appendStringInfo(result, "INCREMENTAL FROM LSN: %X/%08X\n",
|
||||
LSN_FORMAT_ARGS(state->istartpoint));
|
||||
appendStringInfo(result, "INCREMENTAL FROM TLI: %u\n",
|
||||
state->istarttli);
|
||||
|
||||
@@ -546,7 +546,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
|
||||
|
||||
#ifdef XLOGPREFETCHER_DEBUG_LEVEL
|
||||
elog(XLOGPREFETCHER_DEBUG_LEVEL,
|
||||
"suppressing all readahead until %X/%X is replayed due to possible TLI change",
|
||||
"suppressing all readahead until %X/%08X is replayed due to possible TLI change",
|
||||
LSN_FORMAT_ARGS(record->lsn));
|
||||
#endif
|
||||
|
||||
@@ -579,7 +579,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
|
||||
|
||||
#ifdef XLOGPREFETCHER_DEBUG_LEVEL
|
||||
elog(XLOGPREFETCHER_DEBUG_LEVEL,
|
||||
"suppressing prefetch in database %u until %X/%X is replayed due to raw file copy",
|
||||
"suppressing prefetch in database %u until %X/%08X is replayed due to raw file copy",
|
||||
rlocator.dbOid,
|
||||
LSN_FORMAT_ARGS(record->lsn));
|
||||
#endif
|
||||
@@ -607,7 +607,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
|
||||
|
||||
#ifdef XLOGPREFETCHER_DEBUG_LEVEL
|
||||
elog(XLOGPREFETCHER_DEBUG_LEVEL,
|
||||
"suppressing prefetch in relation %u/%u/%u until %X/%X is replayed, which creates the relation",
|
||||
"suppressing prefetch in relation %u/%u/%u until %X/%08X is replayed, which creates the relation",
|
||||
xlrec->rlocator.spcOid,
|
||||
xlrec->rlocator.dbOid,
|
||||
xlrec->rlocator.relNumber,
|
||||
@@ -630,7 +630,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
|
||||
|
||||
#ifdef XLOGPREFETCHER_DEBUG_LEVEL
|
||||
elog(XLOGPREFETCHER_DEBUG_LEVEL,
|
||||
"suppressing prefetch in relation %u/%u/%u from block %u until %X/%X is replayed, which truncates the relation",
|
||||
"suppressing prefetch in relation %u/%u/%u from block %u until %X/%08X is replayed, which truncates the relation",
|
||||
xlrec->rlocator.spcOid,
|
||||
xlrec->rlocator.dbOid,
|
||||
xlrec->rlocator.relNumber,
|
||||
@@ -729,7 +729,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
|
||||
{
|
||||
#ifdef XLOGPREFETCHER_DEBUG_LEVEL
|
||||
elog(XLOGPREFETCHER_DEBUG_LEVEL,
|
||||
"suppressing all prefetch in relation %u/%u/%u until %X/%X is replayed, because the relation does not exist on disk",
|
||||
"suppressing all prefetch in relation %u/%u/%u until %X/%08X is replayed, because the relation does not exist on disk",
|
||||
reln->smgr_rlocator.locator.spcOid,
|
||||
reln->smgr_rlocator.locator.dbOid,
|
||||
reln->smgr_rlocator.locator.relNumber,
|
||||
@@ -750,7 +750,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
|
||||
{
|
||||
#ifdef XLOGPREFETCHER_DEBUG_LEVEL
|
||||
elog(XLOGPREFETCHER_DEBUG_LEVEL,
|
||||
"suppressing prefetch in relation %u/%u/%u from block %u until %X/%X is replayed, because the relation is too small",
|
||||
"suppressing prefetch in relation %u/%u/%u from block %u until %X/%08X is replayed, because the relation is too small",
|
||||
reln->smgr_rlocator.locator.spcOid,
|
||||
reln->smgr_rlocator.locator.dbOid,
|
||||
reln->smgr_rlocator.locator.relNumber,
|
||||
@@ -928,7 +928,7 @@ XLogPrefetcherIsFiltered(XLogPrefetcher *prefetcher, RelFileLocator rlocator,
|
||||
{
|
||||
#ifdef XLOGPREFETCHER_DEBUG_LEVEL
|
||||
elog(XLOGPREFETCHER_DEBUG_LEVEL,
|
||||
"prefetch of %u/%u/%u block %u suppressed; filtering until LSN %X/%X is replayed (blocks >= %u filtered)",
|
||||
"prefetch of %u/%u/%u block %u suppressed; filtering until LSN %X/%08X is replayed (blocks >= %u filtered)",
|
||||
rlocator.spcOid, rlocator.dbOid, rlocator.relNumber, blockno,
|
||||
LSN_FORMAT_ARGS(filter->filter_until_replayed),
|
||||
filter->filter_from_block);
|
||||
@@ -944,7 +944,7 @@ XLogPrefetcherIsFiltered(XLogPrefetcher *prefetcher, RelFileLocator rlocator,
|
||||
{
|
||||
#ifdef XLOGPREFETCHER_DEBUG_LEVEL
|
||||
elog(XLOGPREFETCHER_DEBUG_LEVEL,
|
||||
"prefetch of %u/%u/%u block %u suppressed; filtering until LSN %X/%X is replayed (whole database)",
|
||||
"prefetch of %u/%u/%u block %u suppressed; filtering until LSN %X/%08X is replayed (whole database)",
|
||||
rlocator.spcOid, rlocator.dbOid, rlocator.relNumber, blockno,
|
||||
LSN_FORMAT_ARGS(filter->filter_until_replayed));
|
||||
#endif
|
||||
|
||||
@@ -617,7 +617,7 @@ restart:
|
||||
}
|
||||
else if (targetRecOff < pageHeaderSize)
|
||||
{
|
||||
report_invalid_record(state, "invalid record offset at %X/%X: expected at least %u, got %u",
|
||||
report_invalid_record(state, "invalid record offset at %X/%08X: expected at least %u, got %u",
|
||||
LSN_FORMAT_ARGS(RecPtr),
|
||||
pageHeaderSize, targetRecOff);
|
||||
goto err;
|
||||
@@ -626,7 +626,7 @@ restart:
|
||||
if ((((XLogPageHeader) state->readBuf)->xlp_info & XLP_FIRST_IS_CONTRECORD) &&
|
||||
targetRecOff == pageHeaderSize)
|
||||
{
|
||||
report_invalid_record(state, "contrecord is requested by %X/%X",
|
||||
report_invalid_record(state, "contrecord is requested by %X/%08X",
|
||||
LSN_FORMAT_ARGS(RecPtr));
|
||||
goto err;
|
||||
}
|
||||
@@ -667,7 +667,7 @@ restart:
|
||||
if (total_len < SizeOfXLogRecord)
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"invalid record length at %X/%X: expected at least %u, got %u",
|
||||
"invalid record length at %X/%08X: expected at least %u, got %u",
|
||||
LSN_FORMAT_ARGS(RecPtr),
|
||||
(uint32) SizeOfXLogRecord, total_len);
|
||||
goto err;
|
||||
@@ -756,7 +756,7 @@ restart:
|
||||
if (!(pageHeader->xlp_info & XLP_FIRST_IS_CONTRECORD))
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"there is no contrecord flag at %X/%X",
|
||||
"there is no contrecord flag at %X/%08X",
|
||||
LSN_FORMAT_ARGS(RecPtr));
|
||||
goto err;
|
||||
}
|
||||
@@ -769,7 +769,7 @@ restart:
|
||||
total_len != (pageHeader->xlp_rem_len + gotlen))
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"invalid contrecord length %u (expected %lld) at %X/%X",
|
||||
"invalid contrecord length %u (expected %lld) at %X/%08X",
|
||||
pageHeader->xlp_rem_len,
|
||||
((long long) total_len) - gotlen,
|
||||
LSN_FORMAT_ARGS(RecPtr));
|
||||
@@ -1132,7 +1132,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
|
||||
if (record->xl_tot_len < SizeOfXLogRecord)
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"invalid record length at %X/%X: expected at least %u, got %u",
|
||||
"invalid record length at %X/%08X: expected at least %u, got %u",
|
||||
LSN_FORMAT_ARGS(RecPtr),
|
||||
(uint32) SizeOfXLogRecord, record->xl_tot_len);
|
||||
return false;
|
||||
@@ -1140,7 +1140,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
|
||||
if (!RmgrIdIsValid(record->xl_rmid))
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"invalid resource manager ID %u at %X/%X",
|
||||
"invalid resource manager ID %u at %X/%08X",
|
||||
record->xl_rmid, LSN_FORMAT_ARGS(RecPtr));
|
||||
return false;
|
||||
}
|
||||
@@ -1153,7 +1153,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
|
||||
if (!(record->xl_prev < RecPtr))
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"record with incorrect prev-link %X/%X at %X/%X",
|
||||
"record with incorrect prev-link %X/%08X at %X/%08X",
|
||||
LSN_FORMAT_ARGS(record->xl_prev),
|
||||
LSN_FORMAT_ARGS(RecPtr));
|
||||
return false;
|
||||
@@ -1169,7 +1169,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
|
||||
if (record->xl_prev != PrevRecPtr)
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"record with incorrect prev-link %X/%X at %X/%X",
|
||||
"record with incorrect prev-link %X/%08X at %X/%08X",
|
||||
LSN_FORMAT_ARGS(record->xl_prev),
|
||||
LSN_FORMAT_ARGS(RecPtr));
|
||||
return false;
|
||||
@@ -1207,7 +1207,7 @@ ValidXLogRecord(XLogReaderState *state, XLogRecord *record, XLogRecPtr recptr)
|
||||
if (!EQ_CRC32C(record->xl_crc, crc))
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"incorrect resource manager data checksum in record at %X/%X",
|
||||
"incorrect resource manager data checksum in record at %X/%08X",
|
||||
LSN_FORMAT_ARGS(recptr));
|
||||
return false;
|
||||
}
|
||||
@@ -1241,7 +1241,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
|
||||
XLogFileName(fname, state->seg.ws_tli, segno, state->segcxt.ws_segsize);
|
||||
|
||||
report_invalid_record(state,
|
||||
"invalid magic number %04X in WAL segment %s, LSN %X/%X, offset %u",
|
||||
"invalid magic number %04X in WAL segment %s, LSN %X/%08X, offset %u",
|
||||
hdr->xlp_magic,
|
||||
fname,
|
||||
LSN_FORMAT_ARGS(recptr),
|
||||
@@ -1256,7 +1256,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
|
||||
XLogFileName(fname, state->seg.ws_tli, segno, state->segcxt.ws_segsize);
|
||||
|
||||
report_invalid_record(state,
|
||||
"invalid info bits %04X in WAL segment %s, LSN %X/%X, offset %u",
|
||||
"invalid info bits %04X in WAL segment %s, LSN %X/%08X, offset %u",
|
||||
hdr->xlp_info,
|
||||
fname,
|
||||
LSN_FORMAT_ARGS(recptr),
|
||||
@@ -1298,7 +1298,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
|
||||
|
||||
/* hmm, first page of file doesn't have a long header? */
|
||||
report_invalid_record(state,
|
||||
"invalid info bits %04X in WAL segment %s, LSN %X/%X, offset %u",
|
||||
"invalid info bits %04X in WAL segment %s, LSN %X/%08X, offset %u",
|
||||
hdr->xlp_info,
|
||||
fname,
|
||||
LSN_FORMAT_ARGS(recptr),
|
||||
@@ -1318,7 +1318,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
|
||||
XLogFileName(fname, state->seg.ws_tli, segno, state->segcxt.ws_segsize);
|
||||
|
||||
report_invalid_record(state,
|
||||
"unexpected pageaddr %X/%X in WAL segment %s, LSN %X/%X, offset %u",
|
||||
"unexpected pageaddr %X/%08X in WAL segment %s, LSN %X/%08X, offset %u",
|
||||
LSN_FORMAT_ARGS(hdr->xlp_pageaddr),
|
||||
fname,
|
||||
LSN_FORMAT_ARGS(recptr),
|
||||
@@ -1344,7 +1344,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
|
||||
XLogFileName(fname, state->seg.ws_tli, segno, state->segcxt.ws_segsize);
|
||||
|
||||
report_invalid_record(state,
|
||||
"out-of-sequence timeline ID %u (after %u) in WAL segment %s, LSN %X/%X, offset %u",
|
||||
"out-of-sequence timeline ID %u (after %u) in WAL segment %s, LSN %X/%08X, offset %u",
|
||||
hdr->xlp_tli,
|
||||
state->latestPageTLI,
|
||||
fname,
|
||||
@@ -1756,7 +1756,7 @@ DecodeXLogRecord(XLogReaderState *state,
|
||||
if (block_id <= decoded->max_block_id)
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"out-of-order block_id %u at %X/%X",
|
||||
"out-of-order block_id %u at %X/%08X",
|
||||
block_id,
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
@@ -1780,14 +1780,14 @@ DecodeXLogRecord(XLogReaderState *state,
|
||||
if (blk->has_data && blk->data_len == 0)
|
||||
{
|
||||
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/%08X",
|
||||
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",
|
||||
"BKPBLOCK_HAS_DATA not set, but data length is %u at %X/%08X",
|
||||
(unsigned int) blk->data_len,
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
@@ -1823,7 +1823,7 @@ DecodeXLogRecord(XLogReaderState *state,
|
||||
blk->bimg_len == BLCKSZ))
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"BKPIMAGE_HAS_HOLE set, but hole offset %u length %u block image length %u at %X/%X",
|
||||
"BKPIMAGE_HAS_HOLE set, but hole offset %u length %u block image length %u at %X/%08X",
|
||||
(unsigned int) blk->hole_offset,
|
||||
(unsigned int) blk->hole_length,
|
||||
(unsigned int) blk->bimg_len,
|
||||
@@ -1839,7 +1839,7 @@ DecodeXLogRecord(XLogReaderState *state,
|
||||
(blk->hole_offset != 0 || blk->hole_length != 0))
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"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/%08X",
|
||||
(unsigned int) blk->hole_offset,
|
||||
(unsigned int) blk->hole_length,
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
@@ -1853,7 +1853,7 @@ DecodeXLogRecord(XLogReaderState *state,
|
||||
blk->bimg_len == BLCKSZ)
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"BKPIMAGE_COMPRESSED set, but block image length %u at %X/%X",
|
||||
"BKPIMAGE_COMPRESSED set, but block image length %u at %X/%08X",
|
||||
(unsigned int) blk->bimg_len,
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
@@ -1868,7 +1868,7 @@ DecodeXLogRecord(XLogReaderState *state,
|
||||
blk->bimg_len != BLCKSZ)
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"neither BKPIMAGE_HAS_HOLE nor BKPIMAGE_COMPRESSED set, but block image length is %u at %X/%X",
|
||||
"neither BKPIMAGE_HAS_HOLE nor BKPIMAGE_COMPRESSED set, but block image length is %u at %X/%08X",
|
||||
(unsigned int) blk->data_len,
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
@@ -1884,7 +1884,7 @@ DecodeXLogRecord(XLogReaderState *state,
|
||||
if (rlocator == NULL)
|
||||
{
|
||||
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/%08X",
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
}
|
||||
@@ -1896,7 +1896,7 @@ DecodeXLogRecord(XLogReaderState *state,
|
||||
else
|
||||
{
|
||||
report_invalid_record(state,
|
||||
"invalid block_id %u at %X/%X",
|
||||
"invalid block_id %u at %X/%08X",
|
||||
block_id, LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
goto err;
|
||||
}
|
||||
@@ -1963,7 +1963,7 @@ DecodeXLogRecord(XLogReaderState *state,
|
||||
|
||||
shortdata_err:
|
||||
report_invalid_record(state,
|
||||
"record with invalid length at %X/%X",
|
||||
"record with invalid length at %X/%08X",
|
||||
LSN_FORMAT_ARGS(state->ReadRecPtr));
|
||||
err:
|
||||
*errormsg = state->errormsg_buf;
|
||||
@@ -2073,14 +2073,14 @@ RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
|
||||
!record->record->blocks[block_id].in_use)
|
||||
{
|
||||
report_invalid_record(record,
|
||||
"could not restore image at %X/%X with invalid block %d specified",
|
||||
"could not restore image at %X/%08X with invalid block %d specified",
|
||||
LSN_FORMAT_ARGS(record->ReadRecPtr),
|
||||
block_id);
|
||||
return false;
|
||||
}
|
||||
if (!record->record->blocks[block_id].has_image)
|
||||
{
|
||||
report_invalid_record(record, "could not restore image at %X/%X with invalid state, block %d",
|
||||
report_invalid_record(record, "could not restore image at %X/%08X with invalid state, block %d",
|
||||
LSN_FORMAT_ARGS(record->ReadRecPtr),
|
||||
block_id);
|
||||
return false;
|
||||
@@ -2107,7 +2107,7 @@ RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
|
||||
bkpb->bimg_len, BLCKSZ - bkpb->hole_length) <= 0)
|
||||
decomp_success = false;
|
||||
#else
|
||||
report_invalid_record(record, "could not restore image at %X/%X compressed with %s not supported by build, block %d",
|
||||
report_invalid_record(record, "could not restore image at %X/%08X compressed with %s not supported by build, block %d",
|
||||
LSN_FORMAT_ARGS(record->ReadRecPtr),
|
||||
"LZ4",
|
||||
block_id);
|
||||
@@ -2124,7 +2124,7 @@ RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
|
||||
if (ZSTD_isError(decomp_result))
|
||||
decomp_success = false;
|
||||
#else
|
||||
report_invalid_record(record, "could not restore image at %X/%X compressed with %s not supported by build, block %d",
|
||||
report_invalid_record(record, "could not restore image at %X/%08X compressed with %s not supported by build, block %d",
|
||||
LSN_FORMAT_ARGS(record->ReadRecPtr),
|
||||
"zstd",
|
||||
block_id);
|
||||
@@ -2133,7 +2133,7 @@ RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
|
||||
}
|
||||
else
|
||||
{
|
||||
report_invalid_record(record, "could not restore image at %X/%X compressed with unknown method, block %d",
|
||||
report_invalid_record(record, "could not restore image at %X/%08X compressed with unknown method, block %d",
|
||||
LSN_FORMAT_ARGS(record->ReadRecPtr),
|
||||
block_id);
|
||||
return false;
|
||||
@@ -2141,7 +2141,7 @@ RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
|
||||
|
||||
if (!decomp_success)
|
||||
{
|
||||
report_invalid_record(record, "could not decompress image at %X/%X, block %d",
|
||||
report_invalid_record(record, "could not decompress image at %X/%08X, block %d",
|
||||
LSN_FORMAT_ARGS(record->ReadRecPtr),
|
||||
block_id);
|
||||
return false;
|
||||
|
||||
@@ -620,10 +620,10 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
|
||||
* than ControlFile->checkPoint is used.
|
||||
*/
|
||||
ereport(LOG,
|
||||
(errmsg("starting backup recovery with redo LSN %X/%X, checkpoint LSN %X/%X, on timeline ID %u",
|
||||
LSN_FORMAT_ARGS(RedoStartLSN),
|
||||
LSN_FORMAT_ARGS(CheckPointLoc),
|
||||
CheckPointTLI)));
|
||||
errmsg("starting backup recovery with redo LSN %X/%08X, checkpoint LSN %X/%08X, on timeline ID %u",
|
||||
LSN_FORMAT_ARGS(RedoStartLSN),
|
||||
LSN_FORMAT_ARGS(CheckPointLoc),
|
||||
CheckPointTLI));
|
||||
|
||||
/*
|
||||
* When a backup_label file is present, we want to roll forward from
|
||||
@@ -636,8 +636,8 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
|
||||
memcpy(&checkPoint, XLogRecGetData(xlogreader), sizeof(CheckPoint));
|
||||
wasShutdown = ((record->xl_info & ~XLR_INFO_MASK) == XLOG_CHECKPOINT_SHUTDOWN);
|
||||
ereport(DEBUG1,
|
||||
(errmsg_internal("checkpoint record is at %X/%X",
|
||||
LSN_FORMAT_ARGS(CheckPointLoc))));
|
||||
errmsg_internal("checkpoint record is at %X/%08X",
|
||||
LSN_FORMAT_ARGS(CheckPointLoc)));
|
||||
InRecovery = true; /* force recovery even if SHUTDOWNED */
|
||||
|
||||
/*
|
||||
@@ -652,23 +652,23 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
|
||||
if (!ReadRecord(xlogprefetcher, LOG, false,
|
||||
checkPoint.ThisTimeLineID))
|
||||
ereport(FATAL,
|
||||
(errmsg("could not find redo location %X/%X referenced by checkpoint record at %X/%X",
|
||||
LSN_FORMAT_ARGS(checkPoint.redo), LSN_FORMAT_ARGS(CheckPointLoc)),
|
||||
errhint("If you are restoring from a backup, touch \"%s/recovery.signal\" or \"%s/standby.signal\" and add required recovery options.\n"
|
||||
"If you are not restoring from a backup, try removing the file \"%s/backup_label\".\n"
|
||||
"Be careful: removing \"%s/backup_label\" will result in a corrupt cluster if restoring from a backup.",
|
||||
DataDir, DataDir, DataDir, DataDir)));
|
||||
errmsg("could not find redo location %X/%08X referenced by checkpoint record at %X/%08X",
|
||||
LSN_FORMAT_ARGS(checkPoint.redo), LSN_FORMAT_ARGS(CheckPointLoc)),
|
||||
errhint("If you are restoring from a backup, touch \"%s/recovery.signal\" or \"%s/standby.signal\" and add required recovery options.\n"
|
||||
"If you are not restoring from a backup, try removing the file \"%s/backup_label\".\n"
|
||||
"Be careful: removing \"%s/backup_label\" will result in a corrupt cluster if restoring from a backup.",
|
||||
DataDir, DataDir, DataDir, DataDir));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ereport(FATAL,
|
||||
(errmsg("could not locate required checkpoint record at %X/%X",
|
||||
LSN_FORMAT_ARGS(CheckPointLoc)),
|
||||
errhint("If you are restoring from a backup, touch \"%s/recovery.signal\" or \"%s/standby.signal\" and add required recovery options.\n"
|
||||
"If you are not restoring from a backup, try removing the file \"%s/backup_label\".\n"
|
||||
"Be careful: removing \"%s/backup_label\" will result in a corrupt cluster if restoring from a backup.",
|
||||
DataDir, DataDir, DataDir, DataDir)));
|
||||
errmsg("could not locate required checkpoint record at %X/%08X",
|
||||
LSN_FORMAT_ARGS(CheckPointLoc)),
|
||||
errhint("If you are restoring from a backup, touch \"%s/recovery.signal\" or \"%s/standby.signal\" and add required recovery options.\n"
|
||||
"If you are not restoring from a backup, try removing the file \"%s/backup_label\".\n"
|
||||
"Be careful: removing \"%s/backup_label\" will result in a corrupt cluster if restoring from a backup.",
|
||||
DataDir, DataDir, DataDir, DataDir));
|
||||
wasShutdown = false; /* keep compiler quiet */
|
||||
}
|
||||
|
||||
@@ -773,8 +773,8 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
|
||||
*/
|
||||
if (!XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
|
||||
ereport(LOG,
|
||||
(errmsg("restarting backup recovery with redo LSN %X/%X",
|
||||
LSN_FORMAT_ARGS(ControlFile->backupStartPoint))));
|
||||
errmsg("restarting backup recovery with redo LSN %X/%08X",
|
||||
LSN_FORMAT_ARGS(ControlFile->backupStartPoint)));
|
||||
|
||||
/* Get the last valid checkpoint record. */
|
||||
CheckPointLoc = ControlFile->checkPoint;
|
||||
@@ -786,8 +786,8 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
|
||||
if (record != NULL)
|
||||
{
|
||||
ereport(DEBUG1,
|
||||
(errmsg_internal("checkpoint record is at %X/%X",
|
||||
LSN_FORMAT_ARGS(CheckPointLoc))));
|
||||
errmsg_internal("checkpoint record is at %X/%08X",
|
||||
LSN_FORMAT_ARGS(CheckPointLoc)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -798,8 +798,8 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
|
||||
* simplify processing around checkpoints.
|
||||
*/
|
||||
ereport(PANIC,
|
||||
(errmsg("could not locate a valid checkpoint record at %X/%X",
|
||||
LSN_FORMAT_ARGS(CheckPointLoc))));
|
||||
errmsg("could not locate a valid checkpoint record at %X/%08X",
|
||||
LSN_FORMAT_ARGS(CheckPointLoc)));
|
||||
}
|
||||
memcpy(&checkPoint, XLogRecGetData(xlogreader), sizeof(CheckPoint));
|
||||
wasShutdown = ((record->xl_info & ~XLR_INFO_MASK) == XLOG_CHECKPOINT_SHUTDOWN);
|
||||
@@ -824,8 +824,8 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
|
||||
recoveryTargetName)));
|
||||
else if (recoveryTarget == RECOVERY_TARGET_LSN)
|
||||
ereport(LOG,
|
||||
(errmsg("starting point-in-time recovery to WAL location (LSN) \"%X/%X\"",
|
||||
LSN_FORMAT_ARGS(recoveryTargetLSN))));
|
||||
errmsg("starting point-in-time recovery to WAL location (LSN) \"%X/%08X\"",
|
||||
LSN_FORMAT_ARGS(recoveryTargetLSN)));
|
||||
else if (recoveryTarget == RECOVERY_TARGET_IMMEDIATE)
|
||||
ereport(LOG,
|
||||
(errmsg("starting point-in-time recovery to earliest consistent point")));
|
||||
@@ -855,7 +855,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
|
||||
(errmsg("requested timeline %u is not a child of this server's history",
|
||||
recoveryTargetTLI),
|
||||
/* translator: %s is a backup_label file or a pg_control file */
|
||||
errdetail("Latest checkpoint in file \"%s\" 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 in file \"%s\" is at %X/%08X on timeline %u, but in the history of the requested timeline, the server forked off from that timeline at %X/%08X.",
|
||||
haveBackupLabel ? "backup_label" : "pg_control",
|
||||
LSN_FORMAT_ARGS(CheckPointLoc),
|
||||
CheckPointTLI,
|
||||
@@ -870,15 +870,15 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
|
||||
tliOfPointInHistory(ControlFile->minRecoveryPoint - 1, expectedTLEs) !=
|
||||
ControlFile->minRecoveryPointTLI)
|
||||
ereport(FATAL,
|
||||
(errmsg("requested timeline %u does not contain minimum recovery point %X/%X on timeline %u",
|
||||
recoveryTargetTLI,
|
||||
LSN_FORMAT_ARGS(ControlFile->minRecoveryPoint),
|
||||
ControlFile->minRecoveryPointTLI)));
|
||||
errmsg("requested timeline %u does not contain minimum recovery point %X/%08X on timeline %u",
|
||||
recoveryTargetTLI,
|
||||
LSN_FORMAT_ARGS(ControlFile->minRecoveryPoint),
|
||||
ControlFile->minRecoveryPointTLI));
|
||||
|
||||
ereport(DEBUG1,
|
||||
(errmsg_internal("redo record is at %X/%X; shutdown %s",
|
||||
LSN_FORMAT_ARGS(checkPoint.redo),
|
||||
wasShutdown ? "true" : "false")));
|
||||
errmsg_internal("redo record is at %X/%08X; shutdown %s",
|
||||
LSN_FORMAT_ARGS(checkPoint.redo),
|
||||
wasShutdown ? "true" : "false"));
|
||||
ereport(DEBUG1,
|
||||
(errmsg_internal("next transaction ID: " UINT64_FORMAT "; next OID: %u",
|
||||
U64FromFullTransactionId(checkPoint.nextXid),
|
||||
@@ -1253,14 +1253,14 @@ read_backup_label(XLogRecPtr *checkPointLoc, TimeLineID *backupLabelTLI,
|
||||
* is pretty crude, but we are not expecting any variability in the file
|
||||
* format).
|
||||
*/
|
||||
if (fscanf(lfp, "START WAL LOCATION: %X/%X (file %08X%16s)%c",
|
||||
if (fscanf(lfp, "START WAL LOCATION: %X/%08X (file %08X%16s)%c",
|
||||
&hi, &lo, &tli_from_walseg, startxlogfilename, &ch) != 5 || ch != '\n')
|
||||
ereport(FATAL,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("invalid data in file \"%s\"", BACKUP_LABEL_FILE)));
|
||||
RedoStartLSN = ((uint64) hi) << 32 | lo;
|
||||
RedoStartTLI = tli_from_walseg;
|
||||
if (fscanf(lfp, "CHECKPOINT LOCATION: %X/%X%c",
|
||||
if (fscanf(lfp, "CHECKPOINT LOCATION: %X/%08X%c",
|
||||
&hi, &lo, &ch) != 3 || ch != '\n')
|
||||
ereport(FATAL,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
@@ -1332,7 +1332,7 @@ read_backup_label(XLogRecPtr *checkPointLoc, TimeLineID *backupLabelTLI,
|
||||
tli_from_file, BACKUP_LABEL_FILE)));
|
||||
}
|
||||
|
||||
if (fscanf(lfp, "INCREMENTAL FROM LSN: %X/%X\n", &hi, &lo) > 0)
|
||||
if (fscanf(lfp, "INCREMENTAL FROM LSN: %X/%08X\n", &hi, &lo) > 0)
|
||||
ereport(FATAL,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("this is an incremental backup, not a data directory"),
|
||||
@@ -1722,8 +1722,8 @@ PerformWalRecovery(void)
|
||||
if (record->xl_rmid != RM_XLOG_ID ||
|
||||
(record->xl_info & ~XLR_INFO_MASK) != XLOG_CHECKPOINT_REDO)
|
||||
ereport(FATAL,
|
||||
(errmsg("unexpected record type found at redo point %X/%X",
|
||||
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr))));
|
||||
errmsg("unexpected record type found at redo point %X/%08X",
|
||||
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1745,8 +1745,8 @@ PerformWalRecovery(void)
|
||||
RmgrStartup();
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg("redo starts at %X/%X",
|
||||
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr))));
|
||||
errmsg("redo starts at %X/%08X",
|
||||
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr)));
|
||||
|
||||
/* Prepare to report progress of the redo phase. */
|
||||
if (!StandbyMode)
|
||||
@@ -1758,7 +1758,7 @@ PerformWalRecovery(void)
|
||||
do
|
||||
{
|
||||
if (!StandbyMode)
|
||||
ereport_startup_progress("redo in progress, elapsed time: %ld.%02d s, current LSN: %X/%X",
|
||||
ereport_startup_progress("redo in progress, elapsed time: %ld.%02d s, current LSN: %X/%08X",
|
||||
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr));
|
||||
|
||||
#ifdef WAL_DEBUG
|
||||
@@ -1767,7 +1767,7 @@ PerformWalRecovery(void)
|
||||
StringInfoData buf;
|
||||
|
||||
initStringInfo(&buf);
|
||||
appendStringInfo(&buf, "REDO @ %X/%X; LSN %X/%X: ",
|
||||
appendStringInfo(&buf, "REDO @ %X/%08X; LSN %X/%08X: ",
|
||||
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr),
|
||||
LSN_FORMAT_ARGS(xlogreader->EndRecPtr));
|
||||
xlog_outrec(&buf, xlogreader);
|
||||
@@ -1880,9 +1880,9 @@ PerformWalRecovery(void)
|
||||
RmgrCleanup();
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg("redo done at %X/%X system usage: %s",
|
||||
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr),
|
||||
pg_rusage_show(&ru0))));
|
||||
errmsg("redo done at %X/%08X system usage: %s",
|
||||
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr),
|
||||
pg_rusage_show(&ru0)));
|
||||
xtime = GetLatestXTime();
|
||||
if (xtime)
|
||||
ereport(LOG,
|
||||
@@ -2092,7 +2092,7 @@ xlogrecovery_redo(XLogReaderState *record, TimeLineID replayTLI)
|
||||
|
||||
memcpy(&xlrec, XLogRecGetData(record), sizeof(xl_overwrite_contrecord));
|
||||
if (xlrec.overwritten_lsn != record->overwrittenRecPtr)
|
||||
elog(FATAL, "mismatching overwritten LSN %X/%X -> %X/%X",
|
||||
elog(FATAL, "mismatching overwritten LSN %X/%08X -> %X/%08X",
|
||||
LSN_FORMAT_ARGS(xlrec.overwritten_lsn),
|
||||
LSN_FORMAT_ARGS(record->overwrittenRecPtr));
|
||||
|
||||
@@ -2101,9 +2101,9 @@ xlogrecovery_redo(XLogReaderState *record, TimeLineID replayTLI)
|
||||
missingContrecPtr = InvalidXLogRecPtr;
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg("successfully skipped missing contrecord at %X/%X, overwritten at %s",
|
||||
LSN_FORMAT_ARGS(xlrec.overwritten_lsn),
|
||||
timestamptz_to_str(xlrec.overwrite_time))));
|
||||
errmsg("successfully skipped missing contrecord at %X/%08X, overwritten at %s",
|
||||
LSN_FORMAT_ARGS(xlrec.overwritten_lsn),
|
||||
timestamptz_to_str(xlrec.overwrite_time)));
|
||||
|
||||
/* Verifying the record should only happen once */
|
||||
record->overwrittenRecPtr = InvalidXLogRecPtr;
|
||||
@@ -2129,7 +2129,7 @@ xlogrecovery_redo(XLogReaderState *record, TimeLineID replayTLI)
|
||||
backupEndPoint = lsn;
|
||||
}
|
||||
else
|
||||
elog(DEBUG1, "saw end-of-backup record for backup starting at %X/%X, waiting for %X/%X",
|
||||
elog(DEBUG1, "saw end-of-backup record for backup starting at %X/%08X, waiting for %X/%08X",
|
||||
LSN_FORMAT_ARGS(startpoint), LSN_FORMAT_ARGS(backupStartPoint));
|
||||
}
|
||||
}
|
||||
@@ -2224,9 +2224,9 @@ CheckRecoveryConsistency(void)
|
||||
backupEndRequired = false;
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg("completed backup recovery with redo LSN %X/%X and end LSN %X/%X",
|
||||
LSN_FORMAT_ARGS(saveBackupStartPoint),
|
||||
LSN_FORMAT_ARGS(saveBackupEndPoint))));
|
||||
errmsg("completed backup recovery with redo LSN %X/%08X and end LSN %X/%08X",
|
||||
LSN_FORMAT_ARGS(saveBackupStartPoint),
|
||||
LSN_FORMAT_ARGS(saveBackupEndPoint)));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2255,8 +2255,8 @@ CheckRecoveryConsistency(void)
|
||||
reachedConsistency = true;
|
||||
SendPostmasterSignal(PMSIGNAL_RECOVERY_CONSISTENT);
|
||||
ereport(LOG,
|
||||
(errmsg("consistent recovery state reached at %X/%X",
|
||||
LSN_FORMAT_ARGS(lastReplayedEndRecPtr))));
|
||||
errmsg("consistent recovery state reached at %X/%08X",
|
||||
LSN_FORMAT_ARGS(lastReplayedEndRecPtr)));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2293,7 +2293,7 @@ rm_redo_error_callback(void *arg)
|
||||
xlog_block_info(&buf, record);
|
||||
|
||||
/* translator: %s is a WAL record description */
|
||||
errcontext("WAL redo at %X/%X for %s",
|
||||
errcontext("WAL redo at %X/%08X for %s",
|
||||
LSN_FORMAT_ARGS(record->ReadRecPtr),
|
||||
buf.data);
|
||||
|
||||
@@ -2328,7 +2328,7 @@ xlog_outdesc(StringInfo buf, XLogReaderState *record)
|
||||
static void
|
||||
xlog_outrec(StringInfo buf, XLogReaderState *record)
|
||||
{
|
||||
appendStringInfo(buf, "prev %X/%X; xid %u",
|
||||
appendStringInfo(buf, "prev %X/%08X; xid %u",
|
||||
LSN_FORMAT_ARGS(XLogRecGetPrev(record)),
|
||||
XLogRecGetXid(record));
|
||||
|
||||
@@ -2416,10 +2416,10 @@ checkTimeLineSwitch(XLogRecPtr lsn, TimeLineID newTLI, TimeLineID prevTLI,
|
||||
lsn < minRecoveryPoint &&
|
||||
newTLI > minRecoveryPointTLI)
|
||||
ereport(PANIC,
|
||||
(errmsg("unexpected timeline ID %u in checkpoint record, before reaching minimum recovery point %X/%X on timeline %u",
|
||||
newTLI,
|
||||
LSN_FORMAT_ARGS(minRecoveryPoint),
|
||||
minRecoveryPointTLI)));
|
||||
errmsg("unexpected timeline ID %u in checkpoint record, before reaching minimum recovery point %X/%08X on timeline %u",
|
||||
newTLI,
|
||||
LSN_FORMAT_ARGS(minRecoveryPoint),
|
||||
minRecoveryPointTLI));
|
||||
|
||||
/* Looks good */
|
||||
}
|
||||
@@ -2621,8 +2621,8 @@ recoveryStopsBefore(XLogReaderState *record)
|
||||
recoveryStopTime = 0;
|
||||
recoveryStopName[0] = '\0';
|
||||
ereport(LOG,
|
||||
(errmsg("recovery stopping before WAL location (LSN) \"%X/%X\"",
|
||||
LSN_FORMAT_ARGS(recoveryStopLSN))));
|
||||
errmsg("recovery stopping before WAL location (LSN) \"%X/%08X\"",
|
||||
LSN_FORMAT_ARGS(recoveryStopLSN)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2789,8 +2789,8 @@ recoveryStopsAfter(XLogReaderState *record)
|
||||
recoveryStopTime = 0;
|
||||
recoveryStopName[0] = '\0';
|
||||
ereport(LOG,
|
||||
(errmsg("recovery stopping after WAL location (LSN) \"%X/%X\"",
|
||||
LSN_FORMAT_ARGS(recoveryStopLSN))));
|
||||
errmsg("recovery stopping after WAL location (LSN) \"%X/%08X\"",
|
||||
LSN_FORMAT_ARGS(recoveryStopLSN)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2910,7 +2910,7 @@ getRecoveryStopReason(void)
|
||||
timestamptz_to_str(recoveryStopTime));
|
||||
else if (recoveryTarget == RECOVERY_TARGET_LSN)
|
||||
snprintf(reason, sizeof(reason),
|
||||
"%s LSN %X/%X\n",
|
||||
"%s LSN %X/%08X\n",
|
||||
recoveryStopAfter ? "after" : "before",
|
||||
LSN_FORMAT_ARGS(recoveryStopLSN));
|
||||
else if (recoveryTarget == RECOVERY_TARGET_NAME)
|
||||
@@ -3213,11 +3213,11 @@ ReadRecord(XLogPrefetcher *xlogprefetcher, int emode,
|
||||
XLogFileName(fname, xlogreader->seg.ws_tli, segno,
|
||||
wal_segment_size);
|
||||
ereport(emode_for_corrupt_record(emode, xlogreader->EndRecPtr),
|
||||
(errmsg("unexpected timeline ID %u in WAL segment %s, LSN %X/%X, offset %u",
|
||||
xlogreader->latestPageTLI,
|
||||
fname,
|
||||
LSN_FORMAT_ARGS(xlogreader->latestPagePtr),
|
||||
offset)));
|
||||
errmsg("unexpected timeline ID %u in WAL segment %s, LSN %X/%08X, offset %u",
|
||||
xlogreader->latestPageTLI,
|
||||
fname,
|
||||
LSN_FORMAT_ARGS(xlogreader->latestPagePtr),
|
||||
offset));
|
||||
record = NULL;
|
||||
}
|
||||
|
||||
@@ -3429,14 +3429,14 @@ retry:
|
||||
errno = save_errno;
|
||||
ereport(emode_for_corrupt_record(emode, targetPagePtr + reqLen),
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not read from WAL segment %s, LSN %X/%X, offset %u: %m",
|
||||
errmsg("could not read from WAL segment %s, LSN %X/%08X, offset %u: %m",
|
||||
fname, LSN_FORMAT_ARGS(targetPagePtr),
|
||||
readOff)));
|
||||
}
|
||||
else
|
||||
ereport(emode_for_corrupt_record(emode, targetPagePtr + reqLen),
|
||||
(errcode(ERRCODE_DATA_CORRUPTED),
|
||||
errmsg("could not read from WAL segment %s, LSN %X/%X, offset %u: read %d of %zu",
|
||||
errmsg("could not read from WAL segment %s, LSN %X/%08X, offset %u: read %d of %zu",
|
||||
fname, LSN_FORMAT_ARGS(targetPagePtr),
|
||||
readOff, r, (Size) XLOG_BLCKSZ)));
|
||||
goto next_record_is_invalid;
|
||||
@@ -3718,7 +3718,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
|
||||
wait_time = wal_retrieve_retry_interval -
|
||||
TimestampDifferenceMilliseconds(last_fail_time, now);
|
||||
|
||||
elog(LOG, "waiting for WAL to become available at %X/%X",
|
||||
elog(LOG, "waiting for WAL to become available at %X/%08X",
|
||||
LSN_FORMAT_ARGS(RecPtr));
|
||||
|
||||
/* Do background tasks that might benefit us later. */
|
||||
@@ -3864,7 +3864,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
|
||||
tli = tliOfPointInHistory(tliRecPtr, expectedTLEs);
|
||||
|
||||
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/%08X belongs to timeline %u, but previous recovered WAL file came from timeline %u",
|
||||
LSN_FORMAT_ARGS(tliRecPtr),
|
||||
tli, curFileTLI);
|
||||
}
|
||||
@@ -4177,10 +4177,10 @@ rescanLatestTimeLine(TimeLineID replayTLI, XLogRecPtr replayLSN)
|
||||
if (currentTle->end < replayLSN)
|
||||
{
|
||||
ereport(LOG,
|
||||
(errmsg("new timeline %u forked off current database system timeline %u before current recovery point %X/%X",
|
||||
newtarget,
|
||||
replayTLI,
|
||||
LSN_FORMAT_ARGS(replayLSN))));
|
||||
errmsg("new timeline %u forked off current database system timeline %u before current recovery point %X/%08X",
|
||||
newtarget,
|
||||
replayTLI,
|
||||
LSN_FORMAT_ARGS(replayLSN)));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -795,7 +795,7 @@ XLogReadDetermineTimeline(XLogReaderState *state, XLogRecPtr wantPage,
|
||||
|
||||
list_free_deep(timelineHistory);
|
||||
|
||||
elog(DEBUG3, "switched to timeline %u valid until %X/%X",
|
||||
elog(DEBUG3, "switched to timeline %u valid until %X/%08X",
|
||||
state->currTLI,
|
||||
LSN_FORMAT_ARGS(state->currTLIValidUntil));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user