aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2020-05-05 08:00:53 +0530
committerAmit Kapila <akapila@postgresql.org>2020-05-05 08:00:53 +0530
commit69bfaf2e1de49de76d7dec1c45511932a5ef502b (patch)
treee9ff414948222324edbb33f0f603ee4800e218bd /src
parent5545b69ae65f27ba1f4ceaf24486e98c186e9412 (diff)
downloadpostgresql-69bfaf2e1de49de76d7dec1c45511932a5ef502b.tar.gz
postgresql-69bfaf2e1de49de76d7dec1c45511932a5ef502b.zip
Change the display of WAL usage statistics in Explain.
In commit 33e05f89c5, we have added the option to display WAL usage statistics in Explain and auto_explain. The display format used two spaces between each field which is inconsistent with Buffer usage statistics which is using one space between each field. Change the format to make WAL usage statistics consistent with Buffer usage statistics. This commit also changed the usage of "full page writes" to "full page images" for WAL usage statistics to make it consistent with other parts of code and docs. Author: Julien Rouhaud, Amit Kapila Reviewed-by: Justin Pryzby, Kyotaro Horiguchi and Amit Kapila Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/heap/vacuumlazy.c4
-rw-r--r--src/backend/access/transam/xlog.c4
-rw-r--r--src/backend/access/transam/xloginsert.c12
-rw-r--r--src/backend/commands/explain.c20
-rw-r--r--src/backend/executor/instrument.c4
-rw-r--r--src/include/access/xlog.h2
-rw-r--r--src/include/executor/instrument.h2
7 files changed, 24 insertions, 24 deletions
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 3c18db29f13..3bef0e124ba 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -673,10 +673,10 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
read_rate, write_rate);
appendStringInfo(&buf, _("system usage: %s\n"), pg_rusage_show(&ru0));
appendStringInfo(&buf,
- _("WAL usage: %ld records, %ld full page writes, "
+ _("WAL usage: %ld records, %ld full page images, "
UINT64_FORMAT " bytes"),
walusage.wal_records,
- walusage.wal_fpw,
+ walusage.wal_fpi,
walusage.wal_bytes);
ereport(LOG,
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 065eb275b1c..0d3d6709284 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -998,7 +998,7 @@ XLogRecPtr
XLogInsertRecord(XLogRecData *rdata,
XLogRecPtr fpw_lsn,
uint8 flags,
- int num_fpw)
+ int num_fpi)
{
XLogCtlInsert *Insert = &XLogCtl->Insert;
pg_crc32c rdata_crc;
@@ -1259,7 +1259,7 @@ XLogInsertRecord(XLogRecData *rdata,
{
pgWalUsage.wal_bytes += rechdr->xl_tot_len;
pgWalUsage.wal_records++;
- pgWalUsage.wal_fpw += num_fpw;
+ pgWalUsage.wal_fpi += num_fpi;
}
return EndPos;
diff --git a/src/backend/access/transam/xloginsert.c b/src/backend/access/transam/xloginsert.c
index 4259309dbae..b21679f09eb 100644
--- a/src/backend/access/transam/xloginsert.c
+++ b/src/backend/access/transam/xloginsert.c
@@ -109,7 +109,7 @@ static MemoryContext xloginsert_cxt;
static XLogRecData *XLogRecordAssemble(RmgrId rmid, uint8 info,
XLogRecPtr RedoRecPtr, bool doPageWrites,
- XLogRecPtr *fpw_lsn, int *num_fpw);
+ XLogRecPtr *fpw_lsn, int *num_fpi);
static bool XLogCompressBackupBlock(char *page, uint16 hole_offset,
uint16 hole_length, char *dest, uint16 *dlen);
@@ -449,7 +449,7 @@ XLogInsert(RmgrId rmid, uint8 info)
bool doPageWrites;
XLogRecPtr fpw_lsn;
XLogRecData *rdt;
- int num_fpw = 0;
+ int num_fpi = 0;
/*
* Get values needed to decide whether to do full-page writes. Since
@@ -459,9 +459,9 @@ XLogInsert(RmgrId rmid, uint8 info)
GetFullPageWriteInfo(&RedoRecPtr, &doPageWrites);
rdt = XLogRecordAssemble(rmid, info, RedoRecPtr, doPageWrites,
- &fpw_lsn, &num_fpw);
+ &fpw_lsn, &num_fpi);
- EndPos = XLogInsertRecord(rdt, fpw_lsn, curinsert_flags, num_fpw);
+ EndPos = XLogInsertRecord(rdt, fpw_lsn, curinsert_flags, num_fpi);
} while (EndPos == InvalidXLogRecPtr);
XLogResetInsertion();
@@ -484,7 +484,7 @@ XLogInsert(RmgrId rmid, uint8 info)
static XLogRecData *
XLogRecordAssemble(RmgrId rmid, uint8 info,
XLogRecPtr RedoRecPtr, bool doPageWrites,
- XLogRecPtr *fpw_lsn, int *num_fpw)
+ XLogRecPtr *fpw_lsn, int *num_fpi)
{
XLogRecData *rdt;
uint32 total_len = 0;
@@ -638,7 +638,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
bkpb.fork_flags |= BKPBLOCK_HAS_IMAGE;
/* Report a full page image constructed for the WAL record */
- *num_fpw += 1;
+ *num_fpi += 1;
/*
* Construct XLogRecData entries for the page content.
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 7ae61316760..1275bec6732 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -3343,31 +3343,31 @@ 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_fpw > 0) ||
+ if ((usage->wal_records > 0) || (usage->wal_fpi > 0) ||
(usage->wal_bytes > 0))
{
ExplainIndentText(es);
appendStringInfoString(es->str, "WAL:");
if (usage->wal_records > 0)
- appendStringInfo(es->str, " records=%ld",
+ appendStringInfo(es->str, " records=%ld",
usage->wal_records);
- if (usage->wal_fpw > 0)
- appendStringInfo(es->str, " full page writes=%ld",
- usage->wal_fpw);
+ if (usage->wal_fpi > 0)
+ appendStringInfo(es->str, " fpi=%ld",
+ usage->wal_fpi);
if (usage->wal_bytes > 0)
- appendStringInfo(es->str, " bytes=" UINT64_FORMAT,
+ appendStringInfo(es->str, " bytes=" UINT64_FORMAT,
usage->wal_bytes);
appendStringInfoChar(es->str, '\n');
}
}
else
{
- ExplainPropertyInteger("WAL records", NULL,
+ ExplainPropertyInteger("WAL Records", NULL,
usage->wal_records, es);
- ExplainPropertyInteger("WAL full page writes", NULL,
- usage->wal_fpw, es);
- ExplainPropertyUInteger("WAL bytes", NULL,
+ ExplainPropertyInteger("WAL FPI", NULL,
+ usage->wal_fpi, es);
+ ExplainPropertyUInteger("WAL Bytes", NULL,
usage->wal_bytes, es);
}
}
diff --git a/src/backend/executor/instrument.c b/src/backend/executor/instrument.c
index 7c9d7235526..fbedb5aaf60 100644
--- a/src/backend/executor/instrument.c
+++ b/src/backend/executor/instrument.c
@@ -248,7 +248,7 @@ WalUsageAdd(WalUsage *dst, WalUsage *add)
{
dst->wal_bytes += add->wal_bytes;
dst->wal_records += add->wal_records;
- dst->wal_fpw += add->wal_fpw;
+ dst->wal_fpi += add->wal_fpi;
}
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_fpw += add->wal_fpw - sub->wal_fpw;
+ dst->wal_fpi += add->wal_fpi - sub->wal_fpi;
}
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index 0a12afb59e6..e917dfe92d8 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -280,7 +280,7 @@ struct XLogRecData;
extern XLogRecPtr XLogInsertRecord(struct XLogRecData *rdata,
XLogRecPtr fpw_lsn,
uint8 flags,
- int num_fpw);
+ int num_fpi);
extern void XLogFlush(XLogRecPtr RecPtr);
extern bool XLogBackgroundFlush(void);
extern bool XLogNeedsFlush(XLogRecPtr RecPtr);
diff --git a/src/include/executor/instrument.h b/src/include/executor/instrument.h
index 50d672b270d..a97562e7a4f 100644
--- a/src/include/executor/instrument.h
+++ b/src/include/executor/instrument.h
@@ -35,7 +35,7 @@ typedef struct BufferUsage
typedef struct WalUsage
{
long wal_records; /* # of WAL records produced */
- long wal_fpw; /* # of WAL full page writes produced */
+ long wal_fpi; /* # of WAL full page images produced */
uint64 wal_bytes; /* size of WAL records produced */
} WalUsage;