Cosmetic fixups for WAL usage work.
authorAmit Kapila <akapila@postgresql.org>
Mon, 13 Apr 2020 10:01:16 +0000 (15:31 +0530)
committerAmit Kapila <akapila@postgresql.org>
Mon, 13 Apr 2020 10:01:16 +0000 (15:31 +0530)
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

contrib/pg_stat_statements/pg_stat_statements--1.7--1.8.sql
contrib/pg_stat_statements/pg_stat_statements.c
doc/src/sgml/pgstatstatements.sgml
doc/src/sgml/ref/explain.sgml
src/backend/access/heap/vacuumlazy.c
src/backend/access/transam/xlog.c
src/backend/commands/explain.c
src/backend/executor/instrument.c
src/include/executor/instrument.h

index 30566574ab1c76293f64c0280f57c0411e7813bb..d0a6c3b4fc8ac74de37cd4f355014bfee4527ea4 100644 (file)
@@ -43,7 +43,7 @@ CREATE FUNCTION pg_stat_statements(IN showtext boolean,
     OUT blk_read_time float8,
     OUT blk_write_time float8,
     OUT wal_records int8,
-    OUT wal_num_fpw int8,
+    OUT wal_fpw int8,
     OUT wal_bytes numeric
 )
 RETURNS SETOF record
index 04abdab9044d7b2d37707ed2381af7fd401a86f0..90bc6fd013515e8ba3f6b2a8408350e1638059b5 100644 (file)
@@ -189,7 +189,7 @@ typedef struct Counters
    double      blk_write_time; /* time spent writing, in msec */
    double      usage;          /* usage factor */
    int64       wal_records;    /* # of WAL records generated */
-   int64       wal_num_fpw;    /* # of WAL full page image records generated */
+   int64       wal_fpw;    /* # of WAL full page writes generated */
    uint64      wal_bytes;      /* total amount of WAL bytes generated */
 } Counters;
 
@@ -1432,7 +1432,7 @@ pgss_store(const char *query, uint64 queryId,
        e->counters.blk_write_time += INSTR_TIME_GET_MILLISEC(bufusage->blk_write_time);
        e->counters.usage += USAGE_EXEC(total_time);
        e->counters.wal_records += walusage->wal_records;
-       e->counters.wal_num_fpw += walusage->wal_num_fpw;
+       e->counters.wal_fpw += walusage->wal_fpw;
        e->counters.wal_bytes += walusage->wal_bytes;
 
        SpinLockRelease(&e->mutex);
@@ -1824,7 +1824,7 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo,
            Datum       wal_bytes;
 
            values[i++] = Int64GetDatumFast(tmp.wal_records);
-           values[i++] = Int64GetDatumFast(tmp.wal_num_fpw);
+           values[i++] = Int64GetDatumFast(tmp.wal_fpw);
 
            snprintf(buf, sizeof buf, UINT64_FORMAT, tmp.wal_bytes);
 
index 5a962feb39d6be00111eccc5c4a8356559c0ed4a..2120fb4c3f64441b04eb2c05829850ee9925e274 100644 (file)
       <entry><type>bigint</type></entry>
       <entry></entry>
       <entry>
-        Total count of WAL records generated by the statement
+        Total number of WAL records generated by the statement
       </entry>
      </row>
 
      <row>
-      <entry><structfield>wal_num_fpw</structfield></entry>
+      <entry><structfield>wal_fpw</structfield></entry>
       <entry><type>bigint</type></entry>
       <entry></entry>
       <entry>
-        Total count of WAL full page writes generated by the statement
+        Total number of WAL full page writes generated by the statement
       </entry>
      </row>
 
index 024ede4a8d2ce8f08f4069eed236d32b80b52193..aedd70a6ad201a42f4498c4fffa2b167403bd2a6 100644 (file)
@@ -198,8 +198,8 @@ ROLLBACK;
     <listitem>
      <para>
       Include information on WAL record generation. Specifically, include the
-      number of records, number of full page image records and amount of WAL
-      bytes generated.  In text format, only non-zero values are printed.  This
+      number of records, number of full page writes and amount of WAL bytes
+      generated.  In text format, only non-zero values are printed.  This
       parameter may only be used when <literal>ANALYZE</literal> is also
       enabled.  It defaults to <literal>FALSE</literal>.
      </para>
index f3382d37a406e10cc5a0e096f66b8480ed96539e..d8bc06fe0b71b27ba3d5fb9cb380893415d0263b 100644 (file)
@@ -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,
index c38bc1412d8861c78481e2ace67a964e2fcdc20a..11e32733c48ea07fddbf187afd33b761ee1143bd 100644 (file)
@@ -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;
index f3c8da1e01bccefb7d02a9193194959e329ecd8e..7ae613167601729f62fb80c942291b8d9efe5470 100644 (file)
@@ -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);
    }
index 3b9c6aebb929e54b38ff5bdae7f6628fd564c32c..7c9d7235526d9215e9f7d76dd31a85d7b671ad74 100644 (file)
@@ -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;
 }
index 64439c6819cc6ac936ba8c34f8837db3cac70cd4..50d672b270db0c4fb17b51fc5fc8676b4ab10b59 100644 (file)
@@ -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;