Skip to content

Commit ef08ca1

Browse files
author
Amit Kapila
committed
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
1 parent 0c620a5 commit ef08ca1

File tree

9 files changed

+18
-18
lines changed

9 files changed

+18
-18
lines changed

contrib/pg_stat_statements/pg_stat_statements--1.7--1.8.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ CREATE FUNCTION pg_stat_statements(IN showtext boolean,
4343
OUT blk_read_time float8,
4444
OUT blk_write_time float8,
4545
OUT wal_records int8,
46-
OUT wal_num_fpw int8,
46+
OUT wal_fpw int8,
4747
OUT wal_bytes numeric
4848
)
4949
RETURNS SETOF record

contrib/pg_stat_statements/pg_stat_statements.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ typedef struct Counters
189189
double blk_write_time; /* time spent writing, in msec */
190190
double usage; /* usage factor */
191191
int64 wal_records; /* # of WAL records generated */
192-
int64 wal_num_fpw; /* # of WAL full page image records generated */
192+
int64 wal_fpw; /* # of WAL full page writes generated */
193193
uint64 wal_bytes; /* total amount of WAL bytes generated */
194194
} Counters;
195195

@@ -1432,7 +1432,7 @@ pgss_store(const char *query, uint64 queryId,
14321432
e->counters.blk_write_time += INSTR_TIME_GET_MILLISEC(bufusage->blk_write_time);
14331433
e->counters.usage += USAGE_EXEC(total_time);
14341434
e->counters.wal_records += walusage->wal_records;
1435-
e->counters.wal_num_fpw += walusage->wal_num_fpw;
1435+
e->counters.wal_fpw += walusage->wal_fpw;
14361436
e->counters.wal_bytes += walusage->wal_bytes;
14371437

14381438
SpinLockRelease(&e->mutex);
@@ -1824,7 +1824,7 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo,
18241824
Datum wal_bytes;
18251825

18261826
values[i++] = Int64GetDatumFast(tmp.wal_records);
1827-
values[i++] = Int64GetDatumFast(tmp.wal_num_fpw);
1827+
values[i++] = Int64GetDatumFast(tmp.wal_fpw);
18281828

18291829
snprintf(buf, sizeof buf, UINT64_FORMAT, tmp.wal_bytes);
18301830

doc/src/sgml/pgstatstatements.sgml

+3-3
Original file line numberDiff line numberDiff line change
@@ -278,16 +278,16 @@
278278
<entry><type>bigint</type></entry>
279279
<entry></entry>
280280
<entry>
281-
Total count of WAL records generated by the statement
281+
Total number of WAL records generated by the statement
282282
</entry>
283283
</row>
284284

285285
<row>
286-
<entry><structfield>wal_num_fpw</structfield></entry>
286+
<entry><structfield>wal_fpw</structfield></entry>
287287
<entry><type>bigint</type></entry>
288288
<entry></entry>
289289
<entry>
290-
Total count of WAL full page writes generated by the statement
290+
Total number of WAL full page writes generated by the statement
291291
</entry>
292292
</row>
293293

doc/src/sgml/ref/explain.sgml

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ ROLLBACK;
198198
<listitem>
199199
<para>
200200
Include information on WAL record generation. Specifically, include the
201-
number of records, number of full page image records and amount of WAL
202-
bytes generated. In text format, only non-zero values are printed. This
201+
number of records, number of full page writes and amount of WAL bytes
202+
generated. In text format, only non-zero values are printed. This
203203
parameter may only be used when <literal>ANALYZE</literal> is also
204204
enabled. It defaults to <literal>FALSE</literal>.
205205
</para>

src/backend/access/heap/vacuumlazy.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
676676
_("WAL usage: %ld records, %ld full page writes, "
677677
UINT64_FORMAT " bytes"),
678678
walusage.wal_records,
679-
walusage.wal_num_fpw,
679+
walusage.wal_fpw,
680680
walusage.wal_bytes);
681681

682682
ereport(LOG,

src/backend/access/transam/xlog.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ XLogInsertRecord(XLogRecData *rdata,
12581258
{
12591259
pgWalUsage.wal_bytes += rechdr->xl_tot_len;
12601260
pgWalUsage.wal_records++;
1261-
pgWalUsage.wal_num_fpw += num_fpw;
1261+
pgWalUsage.wal_fpw += num_fpw;
12621262
}
12631263

12641264
return EndPos;

src/backend/commands/explain.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -3343,7 +3343,7 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
33433343
if (es->format == EXPLAIN_FORMAT_TEXT)
33443344
{
33453345
/* Show only positive counter values. */
3346-
if ((usage->wal_records > 0) || (usage->wal_num_fpw > 0) ||
3346+
if ((usage->wal_records > 0) || (usage->wal_fpw > 0) ||
33473347
(usage->wal_bytes > 0))
33483348
{
33493349
ExplainIndentText(es);
@@ -3352,9 +3352,9 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
33523352
if (usage->wal_records > 0)
33533353
appendStringInfo(es->str, " records=%ld",
33543354
usage->wal_records);
3355-
if (usage->wal_num_fpw > 0)
3355+
if (usage->wal_fpw > 0)
33563356
appendStringInfo(es->str, " full page writes=%ld",
3357-
usage->wal_num_fpw);
3357+
usage->wal_fpw);
33583358
if (usage->wal_bytes > 0)
33593359
appendStringInfo(es->str, " bytes=" UINT64_FORMAT,
33603360
usage->wal_bytes);
@@ -3366,7 +3366,7 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
33663366
ExplainPropertyInteger("WAL records", NULL,
33673367
usage->wal_records, es);
33683368
ExplainPropertyInteger("WAL full page writes", NULL,
3369-
usage->wal_num_fpw, es);
3369+
usage->wal_fpw, es);
33703370
ExplainPropertyUInteger("WAL bytes", NULL,
33713371
usage->wal_bytes, es);
33723372
}

src/backend/executor/instrument.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,13 @@ WalUsageAdd(WalUsage *dst, WalUsage *add)
248248
{
249249
dst->wal_bytes += add->wal_bytes;
250250
dst->wal_records += add->wal_records;
251-
dst->wal_num_fpw += add->wal_num_fpw;
251+
dst->wal_fpw += add->wal_fpw;
252252
}
253253

254254
void
255255
WalUsageAccumDiff(WalUsage *dst, const WalUsage *add, const WalUsage *sub)
256256
{
257257
dst->wal_bytes += add->wal_bytes - sub->wal_bytes;
258258
dst->wal_records += add->wal_records - sub->wal_records;
259-
dst->wal_num_fpw += add->wal_num_fpw - sub->wal_num_fpw;
259+
dst->wal_fpw += add->wal_fpw - sub->wal_fpw;
260260
}

src/include/executor/instrument.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ typedef struct BufferUsage
3535
typedef struct WalUsage
3636
{
3737
long wal_records; /* # of WAL records produced */
38-
long wal_num_fpw; /* # of WAL full page image writes produced */
38+
long wal_fpw; /* # of WAL full page writes produced */
3939
uint64 wal_bytes; /* size of WAL records produced */
4040
} WalUsage;
4141

0 commit comments

Comments
 (0)