1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-19 23:22:23 +03:00

Use PRI?64 instead of "ll?" in format strings (continued).

Continuation of work started in commit 15a79c73, after initial trial.

Author: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://postgr.es/m/b936d2fb-590d-49c3-a615-92c3a88c6c19%40eisentraut.org
This commit is contained in:
Peter Eisentraut
2025-03-29 10:30:08 +01:00
parent a0a4601765
commit a0ed19e0a9
54 changed files with 302 additions and 311 deletions

View File

@@ -1400,8 +1400,7 @@ brin_summarize_range(PG_FUNCTION_ARGS)
if (heapBlk64 > BRIN_ALL_BLOCKRANGES || heapBlk64 < 0)
ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("block number out of range: %lld",
(long long) heapBlk64)));
errmsg("block number out of range: %" PRId64, heapBlk64)));
heapBlk = (BlockNumber) heapBlk64;
/*
@@ -1508,8 +1507,8 @@ brin_desummarize_range(PG_FUNCTION_ARGS)
if (heapBlk64 > MaxBlockNumber || heapBlk64 < 0)
ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("block number out of range: %lld",
(long long) heapBlk64)));
errmsg("block number out of range: %" PRId64,
heapBlk64)));
heapBlk = (BlockNumber) heapBlk64;
/*

View File

@@ -1020,14 +1020,14 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
orig_rel_pages,
vacrel->eager_scanned_pages);
appendStringInfo(&buf,
_("tuples: %lld removed, %lld remain, %lld are dead but not yet removable\n"),
(long long) vacrel->tuples_deleted,
(long long) vacrel->new_rel_tuples,
(long long) vacrel->recently_dead_tuples);
_("tuples: %" PRId64 " removed, %" PRId64 " remain, %" PRId64 " are dead but not yet removable\n"),
vacrel->tuples_deleted,
(int64) vacrel->new_rel_tuples,
vacrel->recently_dead_tuples);
if (vacrel->missed_dead_tuples > 0)
appendStringInfo(&buf,
_("tuples missed: %lld dead from %u pages not removed due to cleanup lock contention\n"),
(long long) vacrel->missed_dead_tuples,
_("tuples missed: %" PRId64 " dead from %u pages not removed due to cleanup lock contention\n"),
vacrel->missed_dead_tuples,
vacrel->missed_dead_pages);
diff = (int32) (ReadNextTransactionId() -
vacrel->cutoffs.OldestXmin);
@@ -1050,12 +1050,12 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
_("new relminmxid: %u, which is %d MXIDs ahead of previous value\n"),
vacrel->NewRelminMxid, diff);
}
appendStringInfo(&buf, _("frozen: %u pages from table (%.2f%% of total) had %lld tuples frozen\n"),
appendStringInfo(&buf, _("frozen: %u pages from table (%.2f%% of total) had %" PRId64 " tuples frozen\n"),
vacrel->new_frozen_tuple_pages,
orig_rel_pages == 0 ? 100.0 :
100.0 * vacrel->new_frozen_tuple_pages /
orig_rel_pages,
(long long) vacrel->tuples_frozen);
vacrel->tuples_frozen);
appendStringInfo(&buf,
_("visibility map: %u pages set all-visible, %u pages set all-frozen (%u were all-visible)\n"),
@@ -1070,7 +1070,7 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
else
appendStringInfoString(&buf, _("index scan needed: "));
msgfmt = _("%u pages from table (%.2f%% of total) had %lld dead item identifiers removed\n");
msgfmt = _("%u pages from table (%.2f%% of total) had %" PRId64 " dead item identifiers removed\n");
}
else
{
@@ -1079,13 +1079,13 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
else
appendStringInfoString(&buf, _("index scan bypassed by failsafe: "));
msgfmt = _("%u pages from table (%.2f%% of total) have %lld dead item identifiers\n");
msgfmt = _("%u pages from table (%.2f%% of total) have %" PRId64 " dead item identifiers\n");
}
appendStringInfo(&buf, msgfmt,
vacrel->lpdead_item_pages,
orig_rel_pages == 0 ? 100.0 :
100.0 * vacrel->lpdead_item_pages / orig_rel_pages,
(long long) vacrel->lpdead_items);
vacrel->lpdead_items);
for (int i = 0; i < vacrel->nindexes; i++)
{
IndexBulkDeleteResult *istat = vacrel->indstats[i];
@@ -1130,16 +1130,16 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
appendStringInfo(&buf, _("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"),
read_rate, write_rate);
appendStringInfo(&buf,
_("buffer usage: %lld hits, %lld reads, %lld dirtied\n"),
(long long) total_blks_hit,
(long long) total_blks_read,
(long long) total_blks_dirtied);
_("buffer usage: %" PRId64 " hits, %" PRId64 " reads, %" PRId64 " dirtied\n"),
total_blks_hit,
total_blks_read,
total_blks_dirtied);
appendStringInfo(&buf,
_("WAL usage: %lld records, %lld full page images, %llu bytes, %lld buffers full\n"),
(long long) walusage.wal_records,
(long long) walusage.wal_fpi,
(unsigned long long) walusage.wal_bytes,
(long long) walusage.wal_buffers_full);
_("WAL usage: %" PRId64 " records, %" PRId64 " full page images, %" PRIu64 " bytes, %" PRId64 " buffers full\n"),
walusage.wal_records,
walusage.wal_fpi,
walusage.wal_bytes,
walusage.wal_buffers_full);
appendStringInfo(&buf, _("system usage: %s"), pg_rusage_show(&ru0));
ereport(verbose ? INFO : LOG,
@@ -2802,8 +2802,8 @@ lazy_vacuum_heap_rel(LVRelState *vacrel)
vacuumed_pages == vacrel->lpdead_item_pages));
ereport(DEBUG2,
(errmsg("table \"%s\": removed %lld dead item identifiers in %u pages",
vacrel->relname, (long long) vacrel->dead_items_info->num_items,
(errmsg("table \"%s\": removed %" PRId64 " dead item identifiers in %u pages",
vacrel->relname, vacrel->dead_items_info->num_items,
vacuumed_pages)));
/* Revert to the previous phase information for error traceback */

View File

@@ -28,15 +28,15 @@ clog_desc(StringInfo buf, XLogReaderState *record)
int64 pageno;
memcpy(&pageno, rec, sizeof(pageno));
appendStringInfo(buf, "page %lld", (long long) pageno);
appendStringInfo(buf, "page %" PRId64, pageno);
}
else if (info == CLOG_TRUNCATE)
{
xl_clog_truncate xlrec;
memcpy(&xlrec, rec, sizeof(xl_clog_truncate));
appendStringInfo(buf, "page %lld; oldestXact %u",
(long long) xlrec.pageno, xlrec.oldestXact);
appendStringInfo(buf, "page %" PRId64 "; oldestXact %u",
xlrec.pageno, xlrec.oldestXact);
}
}

View File

@@ -28,14 +28,14 @@ commit_ts_desc(StringInfo buf, XLogReaderState *record)
int64 pageno;
memcpy(&pageno, rec, sizeof(pageno));
appendStringInfo(buf, "%lld", (long long) pageno);
appendStringInfo(buf, "%" PRId64, pageno);
}
else if (info == COMMIT_TS_TRUNCATE)
{
xl_commit_ts_truncate *trunc = (xl_commit_ts_truncate *) rec;
appendStringInfo(buf, "pageno %lld, oldestXid %u",
(long long) trunc->pageno, trunc->oldestXid);
appendStringInfo(buf, "pageno %" PRId64 ", oldestXid %u",
trunc->pageno, trunc->oldestXid);
}
}

View File

@@ -58,7 +58,7 @@ multixact_desc(StringInfo buf, XLogReaderState *record)
int64 pageno;
memcpy(&pageno, rec, sizeof(pageno));
appendStringInfo(buf, "%lld", (long long) pageno);
appendStringInfo(buf, "%" PRId64, pageno);
}
else if (info == XLOG_MULTIXACT_CREATE_ID)
{

View File

@@ -320,10 +320,10 @@ xact_desc_stats(StringInfo buf, const char *label,
uint64 objid =
((uint64) dropped_stats[i].objid_hi) << 32 | dropped_stats[i].objid_lo;
appendStringInfo(buf, " %d/%u/%llu",
appendStringInfo(buf, " %d/%u/%" PRIu64,
dropped_stats[i].kind,
dropped_stats[i].dboid,
(unsigned long long) objid);
objid);
}
}
}

View File

@@ -3058,8 +3058,8 @@ PerformMembersTruncation(MultiXactOffset oldestOffset, MultiXactOffset newOldest
*/
while (segment != endsegment)
{
elog(DEBUG2, "truncating multixact members segment %llx",
(unsigned long long) segment);
elog(DEBUG2, "truncating multixact members segment %" PRIx64,
segment);
SlruDeleteSegment(MultiXactMemberCtl, segment);
/* move to next segment, handling wraparound correctly */
@@ -3210,14 +3210,14 @@ TruncateMultiXact(MultiXactId newOldestMulti, Oid newOldestMultiDB)
}
elog(DEBUG1, "performing multixact truncation: "
"offsets [%u, %u), offsets segments [%llx, %llx), "
"members [%u, %u), members segments [%llx, %llx)",
"offsets [%u, %u), offsets segments [%" PRIx64 ", %" PRIx64 "), "
"members [%u, %u), members segments [%" PRIx64 ", %" PRIx64 ")",
oldestMulti, newOldestMulti,
(unsigned long long) MultiXactIdToOffsetSegment(oldestMulti),
(unsigned long long) MultiXactIdToOffsetSegment(newOldestMulti),
MultiXactIdToOffsetSegment(oldestMulti),
MultiXactIdToOffsetSegment(newOldestMulti),
oldestOffset, newOldestOffset,
(unsigned long long) MXOffsetToMemberSegment(oldestOffset),
(unsigned long long) MXOffsetToMemberSegment(newOldestOffset));
MXOffsetToMemberSegment(oldestOffset),
MXOffsetToMemberSegment(newOldestOffset));
/*
* Do truncation, and the WAL logging of the truncation, in a critical
@@ -3470,14 +3470,14 @@ multixact_redo(XLogReaderState *record)
SizeOfMultiXactTruncate);
elog(DEBUG1, "replaying multixact truncation: "
"offsets [%u, %u), offsets segments [%llx, %llx), "
"members [%u, %u), members segments [%llx, %llx)",
"offsets [%u, %u), offsets segments [%" PRIx64 ", %" PRIx64 "), "
"members [%u, %u), members segments [%" PRIx64 ", %" PRIx64 ")",
xlrec.startTruncOff, xlrec.endTruncOff,
(unsigned long long) MultiXactIdToOffsetSegment(xlrec.startTruncOff),
(unsigned long long) MultiXactIdToOffsetSegment(xlrec.endTruncOff),
MultiXactIdToOffsetSegment(xlrec.startTruncOff),
MultiXactIdToOffsetSegment(xlrec.endTruncOff),
xlrec.startTruncMemb, xlrec.endTruncMemb,
(unsigned long long) MXOffsetToMemberSegment(xlrec.startTruncMemb),
(unsigned long long) MXOffsetToMemberSegment(xlrec.endTruncMemb));
MXOffsetToMemberSegment(xlrec.startTruncMemb),
MXOffsetToMemberSegment(xlrec.endTruncMemb));
/* should not be required, but more than cheap enough */
LWLockAcquire(MultiXactTruncationLock, LW_EXCLUSIVE);

View File

@@ -100,8 +100,7 @@ SlruFileName(SlruCtl ctl, char *path, int64 segno)
* that in the future we can't decrease SLRU_PAGES_PER_SEGMENT easily.
*/
Assert(segno >= 0 && segno <= INT64CONST(0xFFFFFFFFFFFFFFF));
return snprintf(path, MAXPGPATH, "%s/%015llX", ctl->Dir,
(long long) segno);
return snprintf(path, MAXPGPATH, "%s/%015" PRIX64, ctl->Dir, segno);
}
else
{

View File

@@ -869,8 +869,8 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
if (mainrdata_len > PG_UINT32_MAX)
ereport(ERROR,
(errmsg_internal("too much WAL data"),
errdetail_internal("Main data length is %llu bytes for a maximum of %u bytes.",
(unsigned long long) mainrdata_len,
errdetail_internal("Main data length is %" PRIu64 " bytes for a maximum of %u bytes.",
mainrdata_len,
PG_UINT32_MAX)));
mainrdata_len_4b = (uint32) mainrdata_len;
@@ -915,8 +915,8 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
if (total_len > XLogRecordMaxSize)
ereport(ERROR,
(errmsg_internal("oversized WAL record"),
errdetail_internal("WAL record would be %llu bytes (of maximum %u bytes); rmid %u flags %u.",
(unsigned long long) total_len, XLogRecordMaxSize, rmid, info)));
errdetail_internal("WAL record would be %" PRIu64 " bytes (of maximum %u bytes); rmid %u flags %u.",
total_len, XLogRecordMaxSize, rmid, info)));
/*
* Fill in the fields in the record header. Prev-link is filled in later,

View File

@@ -1272,9 +1272,9 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
longhdr->xlp_sysid != state->system_identifier)
{
report_invalid_record(state,
"WAL file is from different database system: WAL file database system identifier is %llu, pg_control database system identifier is %llu",
(unsigned long long) longhdr->xlp_sysid,
(unsigned long long) state->system_identifier);
"WAL file is from different database system: WAL file database system identifier is %" PRIu64 ", pg_control database system identifier is %" PRIu64,
longhdr->xlp_sysid,
state->system_identifier);
return false;
}
else if (longhdr->xlp_seg_size != state->segcxt.ws_segsize)