aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2007-06-08 21:09:49 +0000
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2007-06-08 21:09:49 +0000
commit2b438c12cca443fe69852e9b0c678893c8686ac0 (patch)
tree697d7b7402b592b52b30c428d148dd9dcb829f29
parent4213e5f0dbed36d7452f385782eeaa2c8a866173 (diff)
downloadpostgresql-2b438c12cca443fe69852e9b0c678893c8686ac0.tar.gz
postgresql-2b438c12cca443fe69852e9b0c678893c8686ac0.zip
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 a higher level configuration facility, just like -1 in the original coding. We still document that -1 is the value that disables the feature, to avoid confusing the user unnecessarily. Reported by Galy Lee in <200705310914.l4V9E6JA094603@wwwmaster.postgresql.org>; per subsequent discussion.
-rw-r--r--doc/src/sgml/catalogs.sgml4
-rw-r--r--src/backend/postmaster/autovacuum.c16
2 files changed, 13 insertions, 7 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index aa699ae62e1..5ad3aae3aeb 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.153 2007/06/05 21:31:03 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.154 2007/06/08 21:09:49 alvherre Exp $ -->
<!--
Documentation of the system catalogs, directed toward PostgreSQL developers
-->
@@ -1339,7 +1339,7 @@
be used for this particular value. Observe that the
<structfield>vac_cost_delay</> variable inherits its default value from the
<xref linkend="guc-autovacuum-vacuum-cost-delay"> configuration parameter,
- or from <varname>vacuum_cost_delay</> if the former is set to a negative
+ or from <xref linkend="guc-vacuum-cost-delay"> if the former is set to a negative
value. The same applies to <structfield>vac_cost_limit</>.
Also, autovacuum will ignore attempts to set a per-table
<structfield>freeze_max_age</> larger than the system-wide setting (it can only be set
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 752af998313..07bf40707e3 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.47 2007/05/30 20:11:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.48 2007/06/08 21:09:49 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1548,7 +1548,11 @@ static void
autovac_balance_cost(void)
{
WorkerInfo worker;
- int vac_cost_limit = (autovacuum_vac_cost_limit >= 0 ?
+ /*
+ * note: in cost_limit, zero also means use value from elsewhere, because
+ * zero is not a valid value.
+ */
+ int vac_cost_limit = (autovacuum_vac_cost_limit > 0 ?
autovacuum_vac_cost_limit : VacuumCostLimit);
int vac_cost_delay = (autovacuum_vac_cost_delay >= 0 ?
autovacuum_vac_cost_delay : VacuumCostDelay);
@@ -2140,12 +2144,14 @@ table_recheck_autovac(Oid relid)
* there is a tuple in pg_autovacuum, use it; else, use the GUC
* defaults. Note that the fields may contain "-1" (or indeed any
* negative value), which means use the GUC defaults for each setting.
+ * In cost_limit, the value 0 also means to use the value from
+ * elsewhere.
*/
if (avForm != NULL)
{
- vac_cost_limit = (avForm->vac_cost_limit >= 0) ?
+ vac_cost_limit = (avForm->vac_cost_limit > 0) ?
avForm->vac_cost_limit :
- ((autovacuum_vac_cost_limit >= 0) ?
+ ((autovacuum_vac_cost_limit > 0) ?
autovacuum_vac_cost_limit : VacuumCostLimit);
vac_cost_delay = (avForm->vac_cost_delay >= 0) ?
@@ -2158,7 +2164,7 @@ table_recheck_autovac(Oid relid)
}
else
{
- vac_cost_limit = (autovacuum_vac_cost_limit >= 0) ?
+ vac_cost_limit = (autovacuum_vac_cost_limit > 0) ?
autovacuum_vac_cost_limit : VacuumCostLimit;
vac_cost_delay = (autovacuum_vac_cost_delay >= 0) ?