diff options
Diffstat (limited to '')
-rw-r--r-- | src/backend/access/heap/vacuumlazy.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index 4eb953f..c474b06 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -317,9 +317,7 @@ heap_vacuum_rel(Relation rel, VacuumParams *params, PgStat_Counter startreadtime = 0, startwritetime = 0; WalUsage startwalusage = pgWalUsage; - int64 StartPageHit = VacuumPageHit, - StartPageMiss = VacuumPageMiss, - StartPageDirty = VacuumPageDirty; + BufferUsage startbufferusage = pgBufferUsage; ErrorContextCallback errcallback; char **indnames = NULL; @@ -611,18 +609,18 @@ heap_vacuum_rel(Relation rel, VacuumParams *params, long secs_dur; int usecs_dur; WalUsage walusage; + BufferUsage bufferusage; StringInfoData buf; char *msgfmt; int32 diff; - int64 PageHitOp = VacuumPageHit - StartPageHit, - PageMissOp = VacuumPageMiss - StartPageMiss, - PageDirtyOp = VacuumPageDirty - StartPageDirty; double read_rate = 0, write_rate = 0; TimestampDifference(starttime, endtime, &secs_dur, &usecs_dur); memset(&walusage, 0, sizeof(WalUsage)); WalUsageAccumDiff(&walusage, &pgWalUsage, &startwalusage); + memset(&bufferusage, 0, sizeof(BufferUsage)); + BufferUsageAccumDiff(&bufferusage, &pgBufferUsage, &startbufferusage); initStringInfo(&buf); if (verbose) @@ -749,18 +747,18 @@ heap_vacuum_rel(Relation rel, VacuumParams *params, } if (secs_dur > 0 || usecs_dur > 0) { - read_rate = (double) BLCKSZ * PageMissOp / (1024 * 1024) / - (secs_dur + usecs_dur / 1000000.0); - write_rate = (double) BLCKSZ * PageDirtyOp / (1024 * 1024) / - (secs_dur + usecs_dur / 1000000.0); + read_rate = (double) BLCKSZ * (bufferusage.shared_blks_read + bufferusage.local_blks_read) / + (1024 * 1024) / (secs_dur + usecs_dur / 1000000.0); + write_rate = (double) BLCKSZ * (bufferusage.shared_blks_dirtied + bufferusage.local_blks_dirtied) / + (1024 * 1024) / (secs_dur + usecs_dur / 1000000.0); } appendStringInfo(&buf, _("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"), read_rate, write_rate); appendStringInfo(&buf, _("buffer usage: %lld hits, %lld misses, %lld dirtied\n"), - (long long) PageHitOp, - (long long) PageMissOp, - (long long) PageDirtyOp); + (long long) (bufferusage.shared_blks_hit + bufferusage.local_blks_hit), + (long long) (bufferusage.shared_blks_read + bufferusage.local_blks_read), + (long long) (bufferusage.shared_blks_dirtied + bufferusage.local_blks_dirtied)); appendStringInfo(&buf, _("WAL usage: %lld records, %lld full page images, %llu bytes\n"), (long long) walusage.wal_records, @@ -1330,11 +1328,7 @@ lazy_scan_skip(LVRelState *vacrel, Buffer *vmbuffer, BlockNumber next_block, /* DISABLE_PAGE_SKIPPING makes all skipping unsafe */ if (!vacrel->skipwithvm) - { - /* Caller shouldn't rely on all_visible_according_to_vm */ - *next_unskippable_allvis = false; break; - } /* * Aggressive VACUUM caller can't skip pages just because they are |