mirror of
https://github.com/postgres/postgres.git
synced 2025-07-09 22:41:56 +03:00
Cosmetic fixups for WAL usage work.
Reported-by: Justin Pryzby and Euler Taveira Author: Justin Pryzby and Julien Rouhaud Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com
This commit is contained in:
@ -676,7 +676,7 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
|
||||
_("WAL usage: %ld records, %ld full page writes, "
|
||||
UINT64_FORMAT " bytes"),
|
||||
walusage.wal_records,
|
||||
walusage.wal_num_fpw,
|
||||
walusage.wal_fpw,
|
||||
walusage.wal_bytes);
|
||||
|
||||
ereport(LOG,
|
||||
|
@ -1258,7 +1258,7 @@ XLogInsertRecord(XLogRecData *rdata,
|
||||
{
|
||||
pgWalUsage.wal_bytes += rechdr->xl_tot_len;
|
||||
pgWalUsage.wal_records++;
|
||||
pgWalUsage.wal_num_fpw += num_fpw;
|
||||
pgWalUsage.wal_fpw += num_fpw;
|
||||
}
|
||||
|
||||
return EndPos;
|
||||
|
@ -3343,7 +3343,7 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
|
||||
if (es->format == EXPLAIN_FORMAT_TEXT)
|
||||
{
|
||||
/* Show only positive counter values. */
|
||||
if ((usage->wal_records > 0) || (usage->wal_num_fpw > 0) ||
|
||||
if ((usage->wal_records > 0) || (usage->wal_fpw > 0) ||
|
||||
(usage->wal_bytes > 0))
|
||||
{
|
||||
ExplainIndentText(es);
|
||||
@ -3352,9 +3352,9 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
|
||||
if (usage->wal_records > 0)
|
||||
appendStringInfo(es->str, " records=%ld",
|
||||
usage->wal_records);
|
||||
if (usage->wal_num_fpw > 0)
|
||||
if (usage->wal_fpw > 0)
|
||||
appendStringInfo(es->str, " full page writes=%ld",
|
||||
usage->wal_num_fpw);
|
||||
usage->wal_fpw);
|
||||
if (usage->wal_bytes > 0)
|
||||
appendStringInfo(es->str, " bytes=" UINT64_FORMAT,
|
||||
usage->wal_bytes);
|
||||
@ -3366,7 +3366,7 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
|
||||
ExplainPropertyInteger("WAL records", NULL,
|
||||
usage->wal_records, es);
|
||||
ExplainPropertyInteger("WAL full page writes", NULL,
|
||||
usage->wal_num_fpw, es);
|
||||
usage->wal_fpw, es);
|
||||
ExplainPropertyUInteger("WAL bytes", NULL,
|
||||
usage->wal_bytes, es);
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ WalUsageAdd(WalUsage *dst, WalUsage *add)
|
||||
{
|
||||
dst->wal_bytes += add->wal_bytes;
|
||||
dst->wal_records += add->wal_records;
|
||||
dst->wal_num_fpw += add->wal_num_fpw;
|
||||
dst->wal_fpw += add->wal_fpw;
|
||||
}
|
||||
|
||||
void
|
||||
@ -256,5 +256,5 @@ WalUsageAccumDiff(WalUsage *dst, const WalUsage *add, const WalUsage *sub)
|
||||
{
|
||||
dst->wal_bytes += add->wal_bytes - sub->wal_bytes;
|
||||
dst->wal_records += add->wal_records - sub->wal_records;
|
||||
dst->wal_num_fpw += add->wal_num_fpw - sub->wal_num_fpw;
|
||||
dst->wal_fpw += add->wal_fpw - sub->wal_fpw;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ typedef struct BufferUsage
|
||||
typedef struct WalUsage
|
||||
{
|
||||
long wal_records; /* # of WAL records produced */
|
||||
long wal_num_fpw; /* # of WAL full page image writes produced */
|
||||
long wal_fpw; /* # of WAL full page writes produced */
|
||||
uint64 wal_bytes; /* size of WAL records produced */
|
||||
} WalUsage;
|
||||
|
||||
|
Reference in New Issue
Block a user