Alvaro Herrera wrote:
> Matthew T. O'Connor wrote:

> > Can you make 0 and -1 both valid disabled values?  That way it will be 
> > compatible with previous releases.
> 
> Heh, sure, we can do that too and it doesn't seem like anybody would
> object.  I will patch the documentation so that that the "disabled"
> value is zero, and still allow -1.  That way it doesn't seem like there
> should be any objection.

Patch attached.

-- 
Alvaro Herrera                  http://www.amazon.com/gp/registry/5ZYLFMCVHXC
"Saca el libro que tu religión considere como el indicado para encontrar la
oración que traiga paz a tu alma. Luego rebootea el computador
y ve si funciona" (Carlos Duclós)
Index: doc/src/sgml/catalogs.sgml
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/doc/src/sgml/catalogs.sgml,v
retrieving revision 2.153
diff -c -p -r2.153 catalogs.sgml
*** doc/src/sgml/catalogs.sgml	5 Jun 2007 21:31:03 -0000	2.153
--- doc/src/sgml/catalogs.sgml	8 Jun 2007 14:40:10 -0000
***************
*** 1339,1347 ****
     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
!    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
     smaller), and the <structfield>freeze_min_age value</> will be limited to half the
     system-wide <xref linkend="guc-autovacuum-freeze-max-age"> setting.
--- 1339,1350 ----
     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 <xref linkend="guc-vacuum-cost-delay"> if the former is set to a negative
!    value.  <structfield>vac_cost_limit</> is an exception to this rule, because
!    the value <literal>0</> is used to indicate that the
!    <xref linkend="guc-autovacuum-vacuum-cost-limit"> configuration parameter
!    should be used, or <xref linkend="guc-vacuum-cost-limit"> if the former is set to a
!    zero or negative value.  Note that autovacuum will ignore attempts to set a per-table
     <structfield>freeze_max_age</> larger than the system-wide setting (it can only be set
     smaller), and the <structfield>freeze_min_age value</> will be limited to half the
     system-wide <xref linkend="guc-autovacuum-freeze-max-age"> setting.
Index: doc/src/sgml/config.sgml
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/doc/src/sgml/config.sgml,v
retrieving revision 1.126
diff -c -p -r1.126 config.sgml
*** doc/src/sgml/config.sgml	7 Jun 2007 19:19:56 -0000	1.126
--- doc/src/sgml/config.sgml	8 Jun 2007 14:15:33 -0000
*************** SELECT * FROM parent WHERE key = 2400;
*** 3356,3362 ****
        <listitem>
         <para>
          Specifies the cost limit value that will be used in automatic
!         <command>VACUUM</> operations.  If <literal>-1</> is specified (which is the
          default), the regular
          <xref linkend="guc-vacuum-cost-limit"> value will be used.  Note that
          the value is distributed proportionally among the running autovacuum
--- 3356,3362 ----
        <listitem>
         <para>
          Specifies the cost limit value that will be used in automatic
!         <command>VACUUM</> operations.  If <literal>0</> is specified (which is the
          default), the regular
          <xref linkend="guc-vacuum-cost-limit"> value will be used.  Note that
          the value is distributed proportionally among the running autovacuum
Index: src/backend/postmaster/autovacuum.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/postmaster/autovacuum.c,v
retrieving revision 1.47
diff -c -p -r1.47 autovacuum.c
*** src/backend/postmaster/autovacuum.c	30 May 2007 20:11:57 -0000	1.47
--- src/backend/postmaster/autovacuum.c	8 Jun 2007 14:23:35 -0000
*************** static void
*** 1548,1554 ****
  autovac_balance_cost(void)
  {
  	WorkerInfo	worker;
! 	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);
--- 1548,1554 ----
  autovac_balance_cost(void)
  {
  	WorkerInfo	worker;
! 	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);
*************** table_recheck_autovac(Oid relid)
*** 2143,2151 ****
  		 */
  		if (avForm != NULL)
  		{
! 			vac_cost_limit = (avForm->vac_cost_limit >= 0) ?
  				avForm->vac_cost_limit :
! 				((autovacuum_vac_cost_limit >= 0) ?
  				 autovacuum_vac_cost_limit : VacuumCostLimit);
  
  			vac_cost_delay = (avForm->vac_cost_delay >= 0) ?
--- 2143,2151 ----
  		 */
  		if (avForm != NULL)
  		{
! 			vac_cost_limit = (avForm->vac_cost_limit > 0) ?
  				avForm->vac_cost_limit :
! 				((autovacuum_vac_cost_limit > 0) ?
  				 autovacuum_vac_cost_limit : VacuumCostLimit);
  
  			vac_cost_delay = (avForm->vac_cost_delay >= 0) ?
*************** table_recheck_autovac(Oid relid)
*** 2158,2164 ****
  		}
  		else
  		{
! 			vac_cost_limit = (autovacuum_vac_cost_limit >= 0) ?
  				autovacuum_vac_cost_limit : VacuumCostLimit;
  
  			vac_cost_delay = (autovacuum_vac_cost_delay >= 0) ?
--- 2158,2164 ----
  		}
  		else
  		{
! 			vac_cost_limit = (autovacuum_vac_cost_limit > 0) ?
  				autovacuum_vac_cost_limit : VacuumCostLimit;
  
  			vac_cost_delay = (autovacuum_vac_cost_delay >= 0) ?
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.395
diff -c -p -r1.395 guc.c
*** src/backend/utils/misc/guc.c	5 Jun 2007 21:50:19 -0000	1.395
--- src/backend/utils/misc/guc.c	8 Jun 2007 14:12:49 -0000
*************** static struct config_int ConfigureNamesI
*** 1329,1335 ****
  			NULL
  		},
  		&autovacuum_vac_cost_limit,
! 		-1, -1, 10000, NULL, NULL
  	},
  
  	{
--- 1329,1335 ----
  			NULL
  		},
  		&autovacuum_vac_cost_limit,
! 		0, -1, 10000, NULL, NULL
  	},
  
  	{
Index: src/backend/utils/misc/postgresql.conf.sample
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/utils/misc/postgresql.conf.sample,v
retrieving revision 1.216
diff -c -p -r1.216 postgresql.conf.sample
*** src/backend/utils/misc/postgresql.conf.sample	3 Jun 2007 17:08:15 -0000	1.216
--- src/backend/utils/misc/postgresql.conf.sample	8 Jun 2007 14:25:11 -0000
***************
*** 394,401 ****
  #autovacuum_vacuum_cost_delay = -1	# default vacuum cost delay for 
  					# autovacuum, -1 means use 
  					# vacuum_cost_delay
! #autovacuum_vacuum_cost_limit = -1	# default vacuum cost limit for 
! 					# autovacuum, -1 means use
  					# vacuum_cost_limit
  
  
--- 394,401 ----
  #autovacuum_vacuum_cost_delay = -1	# default vacuum cost delay for 
  					# autovacuum, -1 means use 
  					# vacuum_cost_delay
! #autovacuum_vacuum_cost_limit = 0	# default vacuum cost limit for 
! 					# autovacuum, 0 means use
  					# vacuum_cost_limit
  
  
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to