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

Commit357c845

Browse files
Adjust VACUUM's removable cutoff log message.
The age of OldestXmin (a.k.a. "removable cutoff") when VACUUM ends oftenindicates the approximate number of XIDs consumed while VACUUM ran.However, there is at least one important exception: the cutoff could beheld back by a snapshot that was acquired before our VACUUM even began.Successive VACUUM operations may even use exactly the same old cutoff inextreme cases involving long held snapshots.The log messages that described how removable cutoff aged (which wereadded by commit872770f) created the impression that we were reportingon how VACUUM's usable cutoff advanced while VACUUM ran, which wasmisleading in these extreme cases. Fix by using a more general wording.Per gripe from Tom Lane.In passing, relocate related instrumentation code for clarity.Author: Peter Geoghegan <pg@bowt.ie>Discussion:https://postgr.es/m/1643035.1650035653@sss.pgh.pa.us
1 parent9199853 commit357c845

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

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

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -633,30 +633,19 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
633633
TimestampDifferenceExceeds(starttime,endtime,
634634
params->log_min_duration))
635635
{
636-
longsecs;
637-
intusecs;
636+
longsecs_dur;
637+
intusecs_dur;
638638
WalUsagewalusage;
639-
doubleread_rate,
640-
write_rate;
641639
StringInfoDatabuf;
642640
char*msgfmt;
643641
int32diff;
642+
doubleread_rate=0,
643+
write_rate=0;
644644

645-
TimestampDifference(starttime,endtime,&secs,&usecs);
646-
645+
TimestampDifference(starttime,endtime,&secs_dur,&usecs_dur);
647646
memset(&walusage,0,sizeof(WalUsage));
648647
WalUsageAccumDiff(&walusage,&pgWalUsage,&walusage_start);
649648

650-
read_rate=0;
651-
write_rate=0;
652-
if ((secs>0)|| (usecs>0))
653-
{
654-
read_rate= (double)BLCKSZ*VacuumPageMiss / (1024*1024) /
655-
(secs+usecs /1000000.0);
656-
write_rate= (double)BLCKSZ*VacuumPageDirty / (1024*1024) /
657-
(secs+usecs /1000000.0);
658-
}
659-
660649
initStringInfo(&buf);
661650
if (verbose)
662651
{
@@ -710,20 +699,20 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
710699
vacrel->missed_dead_pages);
711700
diff= (int32) (ReadNextTransactionId()-OldestXmin);
712701
appendStringInfo(&buf,
713-
_("removable cutoff: %u,older by %dxids when operation ended\n"),
702+
_("removable cutoff: %u,which was %dXIDs old when operation ended\n"),
714703
OldestXmin,diff);
715704
if (frozenxid_updated)
716705
{
717706
diff= (int32) (vacrel->NewRelfrozenXid-vacrel->relfrozenxid);
718707
appendStringInfo(&buf,
719-
_("new relfrozenxid: %u, which is %dxids ahead of previous value\n"),
708+
_("new relfrozenxid: %u, which is %dXIDs ahead of previous value\n"),
720709
vacrel->NewRelfrozenXid,diff);
721710
}
722711
if (minmulti_updated)
723712
{
724713
diff= (int32) (vacrel->NewRelminMxid-vacrel->relminmxid);
725714
appendStringInfo(&buf,
726-
_("new relminmxid: %u, which is %dmxids ahead of previous value\n"),
715+
_("new relminmxid: %u, which is %dMXIDs ahead of previous value\n"),
727716
vacrel->NewRelminMxid,diff);
728717
}
729718
if (orig_rel_pages>0)
@@ -774,6 +763,13 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
774763
appendStringInfo(&buf,_("I/O timings: read: %.3f ms, write: %.3f ms\n"),
775764
read_ms,write_ms);
776765
}
766+
if (secs_dur>0||usecs_dur>0)
767+
{
768+
read_rate= (double)BLCKSZ*VacuumPageMiss / (1024*1024) /
769+
(secs_dur+usecs_dur /1000000.0);
770+
write_rate= (double)BLCKSZ*VacuumPageDirty / (1024*1024) /
771+
(secs_dur+usecs_dur /1000000.0);
772+
}
777773
appendStringInfo(&buf,_("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"),
778774
read_rate,write_rate);
779775
appendStringInfo(&buf,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp