Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b7ce6de

Browse files
author
Amit Kapila
committed
Allow autovacuum to log WAL usage statistics.
This commit allows autovacuum to log WAL usage statistics added by commit df3b181. Author: Julien Rouhaud Reviewed-by: Dilip Kumar and Amit Kapila Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com
1 parent 8ef9451 commit b7ce6de

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/backend/access/heap/vacuumlazy.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
410410
int nindexes;
411411
PGRUsage ru0;
412412
TimestampTz starttime = 0;
413+
WalUsage walusage_start = pgWalUsage;
414+
WalUsage walusage = {0, 0, 0};
413415
long secs;
414416
int usecs;
415417
double read_rate,
@@ -614,6 +616,9 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
614616

615617
TimestampDifference(starttime, endtime, &secs, &usecs);
616618

619+
memset(&walusage, 0, sizeof(WalUsage));
620+
WalUsageAccumDiff(&walusage, &pgWalUsage, &walusage_start);
621+
617622
read_rate = 0;
618623
write_rate = 0;
619624
if ((secs > 0) || (usecs > 0))
@@ -666,7 +671,13 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
666671
(long long) VacuumPageDirty);
667672
appendStringInfo(&buf, _("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"),
668673
read_rate, write_rate);
669-
appendStringInfo(&buf, _("system usage: %s"), pg_rusage_show(&ru0));
674+
appendStringInfo(&buf, _("system usage: %s\n"), pg_rusage_show(&ru0));
675+
appendStringInfo(&buf,
676+
_("WAL usage: %ld records, %ld full page writes, "
677+
UINT64_FORMAT " bytes"),
678+
walusage.wal_records,
679+
walusage.wal_num_fpw,
680+
walusage.wal_bytes);
670681

671682
ereport(LOG,
672683
(errmsg_internal("%s", buf.data)));

0 commit comments

Comments
 (0)