Galy Lee wrote:

Hi,

I'll deal with each issue separately.

> * Bug-1:  Invalid lower bound of autovacuum_cost_limit
> 
> autovacuum_vacuum_cost_limit should be the following value:
>   autovacuum_vacuum_cost_limit = -1, or [1, 10000]
>   (0 should be prohibited. )
> 
> But 0 can also be accepted for autovacuum_vacuum_cost_limit now.

This is solved easily by adding a check in an assign hook (attached).
The only remaining problem here is that other error messages could be
clearer.

So this is correct:

$ postmaster -c autovacuum_vacuum_cost_limit=0
17902 FATAL:  invalid value for parameter "autovacuum_vacuum_cost_limit": 0

But this is misleading (started postmaster with good value, then edited
postgresql.conf and entered "-2"):

17903 LOG:  received SIGHUP, reloading configuration files
17903 LOG:  -2 is outside the valid range for parameter 
"autovacuum_vacuum_cost_limit" (-1 .. 1000)

Note how it still says the range is -1 .. 1000.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
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	7 Jun 2007 15:51:55 -0000
*************** static const char *show_tcp_keepalives_i
*** 169,174 ****
--- 169,175 ----
  static const char *show_tcp_keepalives_count(void);
  static bool assign_autovacuum_max_workers(int newval, bool doit, GucSource source);
  static bool assign_maxconnections(int newval, bool doit, GucSource source);
+ static bool assign_autovac_vac_cost_limit(int newval, bool doit, GucSource source);
  
  /*
   * GUC option variables that are exported from this module
*************** static struct config_int ConfigureNamesI
*** 1329,1335 ****
  			NULL
  		},
  		&autovacuum_vac_cost_limit,
! 		-1, -1, 10000, NULL, NULL
  	},
  
  	{
--- 1330,1336 ----
  			NULL
  		},
  		&autovacuum_vac_cost_limit,
! 		-1, -1, 10000, &assign_autovac_vac_cost_limit, NULL
  	},
  
  	{
*************** assign_autovacuum_max_workers(int newval
*** 6831,6834 ****
--- 6832,6842 ----
  	return true;
  }
  
+ /* autovacuum_vacuum_cost_limit may be -1, but not 0 */
+ static bool
+ assign_autovac_vac_cost_limit(int newval, bool doit, GucSource source)
+ {
+ 	return newval != 0;
+ }
+ 
  #include "guc-file.c"
---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate

Reply via email to