Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd3609dd

Browse files
Fix multi-table VACUUM VERBOSE accounting.
Per-backend global variables like VacuumPageHit are initialized once perVACUUM command. This was missed by commit49c9d9f, which unifiedVACUUM VERBOSE and autovacuum logging. As a result of that oversight,incorrect values were shown when multiple relations were processed by asingle VACUUM VERBOSE command.Relations that happened to be processed later on would show "bufferusage:" values that incorrectly included buffer accesses made whileprocessing earlier unrelated relations. The same accesses were countedmultiple times.To fix, take initial values for the tracker variables at the start ofheap_vacuum_rel(), and report delta values later on.
1 parent7129a97 commitd3609dd

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

‎src/backend/access/heap/vacuumlazy.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,12 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
325325
new_rel_allvisible;
326326
PGRUsageru0;
327327
TimestampTzstarttime=0;
328-
PgStat_Counterstartreadtime=0;
329-
PgStat_Counterstartwritetime=0;
330-
WalUsagewalusage_start=pgWalUsage;
328+
PgStat_Counterstartreadtime=0,
329+
startwritetime=0;
330+
WalUsagestartwalusage=pgWalUsage;
331+
int64StartPageHit=VacuumPageHit,
332+
StartPageMiss=VacuumPageMiss,
333+
StartPageDirty=VacuumPageDirty;
331334
ErrorContextCallbackerrcallback;
332335
char**indnames=NULL;
333336

@@ -639,12 +642,15 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
639642
StringInfoDatabuf;
640643
char*msgfmt;
641644
int32diff;
645+
int64PageHitOp=VacuumPageHit-StartPageHit,
646+
PageMissOp=VacuumPageMiss-StartPageMiss,
647+
PageDirtyOp=VacuumPageDirty-StartPageDirty;
642648
doubleread_rate=0,
643649
write_rate=0;
644650

645651
TimestampDifference(starttime,endtime,&secs_dur,&usecs_dur);
646652
memset(&walusage,0,sizeof(WalUsage));
647-
WalUsageAccumDiff(&walusage,&pgWalUsage,&walusage_start);
653+
WalUsageAccumDiff(&walusage,&pgWalUsage,&startwalusage);
648654

649655
initStringInfo(&buf);
650656
if (verbose)
@@ -763,18 +769,18 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
763769
}
764770
if (secs_dur>0||usecs_dur>0)
765771
{
766-
read_rate= (double)BLCKSZ*VacuumPageMiss / (1024*1024) /
772+
read_rate= (double)BLCKSZ*PageMissOp / (1024*1024) /
767773
(secs_dur+usecs_dur /1000000.0);
768-
write_rate= (double)BLCKSZ*VacuumPageDirty / (1024*1024) /
774+
write_rate= (double)BLCKSZ*PageDirtyOp / (1024*1024) /
769775
(secs_dur+usecs_dur /1000000.0);
770776
}
771777
appendStringInfo(&buf,_("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"),
772778
read_rate,write_rate);
773779
appendStringInfo(&buf,
774780
_("buffer usage: %lld hits, %lld misses, %lld dirtied\n"),
775-
(long long)VacuumPageHit,
776-
(long long)VacuumPageMiss,
777-
(long long)VacuumPageDirty);
781+
(long long)PageHitOp,
782+
(long long)PageMissOp,
783+
(long long)PageDirtyOp);
778784
appendStringInfo(&buf,
779785
_("WAL usage: %lld records, %lld full page images, %llu bytes\n"),
780786
(long long)walusage.wal_records,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp