1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-17 06:41:09 +03:00

New autovacuum_work_mem parameter

If autovacuum_work_mem is set, autovacuum workers now use
this parameter in preference to maintenance_work_mem.

Peter Geoghegan
This commit is contained in:
Simon Riggs
2013-12-12 11:42:39 +00:00
parent 36da3cfb45
commit 8693559cac
6 changed files with 69 additions and 10 deletions

View File

@ -194,6 +194,7 @@ static const char *show_tcp_keepalives_count(void);
static bool check_maxconnections(int *newval, void **extra, GucSource source);
static bool check_max_worker_processes(int *newval, void **extra, GucSource source);
static bool check_autovacuum_max_workers(int *newval, void **extra, GucSource source);
static bool check_autovacuum_work_mem(int *newval, void **extra, GucSource source);
static bool check_effective_io_concurrency(int *newval, void **extra, GucSource source);
static void assign_effective_io_concurrency(int newval, void *extra);
static void assign_pgstat_temp_directory(const char *newval, void *extra);
@ -2357,6 +2358,17 @@ static struct config_int ConfigureNamesInt[] =
check_autovacuum_max_workers, NULL, NULL
},
{
{"autovacuum_work_mem", PGC_SIGHUP, RESOURCES_MEM,
gettext_noop("Sets the maximum memory to be used by each autovacuum worker process."),
NULL,
GUC_UNIT_KB
},
&autovacuum_work_mem,
-1, -1, MAX_KILOBYTES,
check_autovacuum_work_mem, NULL, NULL
},
{
{"tcp_keepalives_idle", PGC_USERSET, CLIENT_CONN_OTHER,
gettext_noop("Time between issuing TCP keepalives."),
@ -8777,6 +8789,29 @@ check_autovacuum_max_workers(int *newval, void **extra, GucSource source)
return true;
}
static bool
check_autovacuum_work_mem(int *newval, void **extra, GucSource source)
{
/*
* -1 indicates fallback.
*
* If we haven't yet changed the boot_val default of -1, just let it be.
* Autovacuum will look to maintenance_work_mem instead.
*/
if (*newval == -1)
return true;
/*
* We clamp manually-set values to at least 1MB. Since
* maintenance_work_mem is always set to at least this value, do the same
* here.
*/
if (*newval < 1024)
*newval = 1024;
return true;
}
static bool
check_max_worker_processes(int *newval, void **extra, GucSource source)
{