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

Commit2b438c1

Browse files
committed
Avoid passing zero as a value for vacuum_cost_limit, because it's not a valid
value for the vacuum code. Instead, make zero signify getting the value from ahigher level configuration facility, just like -1 in the original coding. Westill document that -1 is the value that disables the feature, to avoidconfusing the user unnecessarily.Reported by Galy Lee in <200705310914.l4V9E6JA094603@wwwmaster.postgresql.org>;per subsequent discussion.
1 parent4213e5f commit2b438c1

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

‎doc/src/sgml/catalogs.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.153 2007/06/05 21:31:03 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.154 2007/06/08 21:09:49 alvherre Exp $ -->
22
<!--
33
Documentation of the system catalogs, directed toward PostgreSQL developers
44
-->
@@ -1339,7 +1339,7 @@
13391339
be used for this particular value. Observe that the
13401340
<structfield>vac_cost_delay</> variable inherits its default value from the
13411341
<xref linkend="guc-autovacuum-vacuum-cost-delay"> configuration parameter,
1342-
or from <varname>vacuum_cost_delay</> if the former is set to a negative
1342+
or from <xref linkend="guc-vacuum-cost-delay"> if the former is set to a negative
13431343
value. The same applies to <structfield>vac_cost_limit</>.
13441344
Also, autovacuum will ignore attempts to set a per-table
13451345
<structfield>freeze_max_age</> larger than the system-wide setting (it can only be set

‎src/backend/postmaster/autovacuum.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.47 2007/05/30 20:11:57 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.48 2007/06/08 21:09:49 alvherre Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -1548,7 +1548,11 @@ static void
15481548
autovac_balance_cost(void)
15491549
{
15501550
WorkerInfoworker;
1551-
intvac_cost_limit= (autovacuum_vac_cost_limit >=0 ?
1551+
/*
1552+
* note: in cost_limit, zero also means use value from elsewhere, because
1553+
* zero is not a valid value.
1554+
*/
1555+
intvac_cost_limit= (autovacuum_vac_cost_limit>0 ?
15521556
autovacuum_vac_cost_limit :VacuumCostLimit);
15531557
intvac_cost_delay= (autovacuum_vac_cost_delay >=0 ?
15541558
autovacuum_vac_cost_delay :VacuumCostDelay);
@@ -2140,12 +2144,14 @@ table_recheck_autovac(Oid relid)
21402144
* there is a tuple in pg_autovacuum, use it; else, use the GUC
21412145
* defaults. Note that the fields may contain "-1" (or indeed any
21422146
* negative value), which means use the GUC defaults for each setting.
2147+
* In cost_limit, the value 0 also means to use the value from
2148+
* elsewhere.
21432149
*/
21442150
if (avForm!=NULL)
21452151
{
2146-
vac_cost_limit= (avForm->vac_cost_limit >=0) ?
2152+
vac_cost_limit= (avForm->vac_cost_limit>0) ?
21472153
avForm->vac_cost_limit :
2148-
((autovacuum_vac_cost_limit >=0) ?
2154+
((autovacuum_vac_cost_limit>0) ?
21492155
autovacuum_vac_cost_limit :VacuumCostLimit);
21502156

21512157
vac_cost_delay= (avForm->vac_cost_delay >=0) ?
@@ -2158,7 +2164,7 @@ table_recheck_autovac(Oid relid)
21582164
}
21592165
else
21602166
{
2161-
vac_cost_limit= (autovacuum_vac_cost_limit >=0) ?
2167+
vac_cost_limit= (autovacuum_vac_cost_limit>0) ?
21622168
autovacuum_vac_cost_limit :VacuumCostLimit;
21632169

21642170
vac_cost_delay= (autovacuum_vac_cost_delay >=0) ?

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp