1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-08 07:21:33 +03:00

Make vacuum buffer counters 64 bits wide

Using 32 bit counters means they can now realistically wrap around when
vacuuming extremely large tables.  Because they're signed integers,
stats printed by vacuum look very odd when they do.

We'd love to backpatch this, but refrain because the variables are
exported and could cause third-party code to break.

Reviewed-by: Julien Rouhaud, Tom Lane, Michael Paquier
Discussion: https://postgr.es/m/20200131205926.GA16367@alvherre.pgsql
This commit is contained in:
Alvaro Herrera 2020-02-05 16:59:29 -03:00
parent 75cdf24ec3
commit 15d13e8291
3 changed files with 10 additions and 10 deletions

View File

@ -614,10 +614,10 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
vacrelstats->new_dead_tuples, vacrelstats->new_dead_tuples,
OldestXmin); OldestXmin);
appendStringInfo(&buf, appendStringInfo(&buf,
_("buffer usage: %d hits, %d misses, %d dirtied\n"), _("buffer usage: %lld hits, %lld misses, %lld dirtied\n"),
VacuumPageHit, (long long) VacuumPageHit,
VacuumPageMiss, (long long) VacuumPageMiss,
VacuumPageDirty); (long long) VacuumPageDirty);
appendStringInfo(&buf, _("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"), appendStringInfo(&buf, _("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"),
read_rate, write_rate); read_rate, write_rate);
appendStringInfo(&buf, _("system usage: %s"), pg_rusage_show(&ru0)); appendStringInfo(&buf, _("system usage: %s"), pg_rusage_show(&ru0));

View File

@ -140,9 +140,9 @@ int VacuumCostPageDirty = 20;
int VacuumCostLimit = 200; int VacuumCostLimit = 200;
double VacuumCostDelay = 0; double VacuumCostDelay = 0;
int VacuumPageHit = 0; int64 VacuumPageHit = 0;
int VacuumPageMiss = 0; int64 VacuumPageMiss = 0;
int VacuumPageDirty = 0; int64 VacuumPageDirty = 0;
int VacuumCostBalance = 0; /* working state for vacuum */ int VacuumCostBalance = 0; /* working state for vacuum */
bool VacuumCostActive = false; bool VacuumCostActive = false;

View File

@ -252,9 +252,9 @@ extern int VacuumCostPageDirty;
extern int VacuumCostLimit; extern int VacuumCostLimit;
extern double VacuumCostDelay; extern double VacuumCostDelay;
extern int VacuumPageHit; extern int64 VacuumPageHit;
extern int VacuumPageMiss; extern int64 VacuumPageMiss;
extern int VacuumPageDirty; extern int64 VacuumPageDirty;
extern int VacuumCostBalance; extern int VacuumCostBalance;
extern bool VacuumCostActive; extern bool VacuumCostActive;