summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2004-02-02 23:01:58 +0300
committerunknown <konstantin@mysql.com>2004-02-02 23:01:58 +0300
commite0b0ec6b2c98f05547018655b6030a8d62bc511f (patch)
treef3ac440023264a510364912fe7f9dbaa97266806 /sql/set_var.cc
parent883f11b68c402b106dbff2542435782a8af3b55d (diff)
downloadmariadb-git-e0b0ec6b2c98f05547018655b6030a8d62bc511f.tar.gz
Proposed (version #2) fix for bug #1948:
"system variable query_prealloc_size can be only global" include/my_sys.h: Fix for bug #1948: - added reset_root_defaults function declaration mysys/my_alloc.c: Fix for bug #1948: - implementation and description of reset_root_defaults sql/set_var.cc: Fix for bug #1948: - fix_thd_mem_root and fix_trans_mem_root after update triggers implemented for variables query_prealloc_size, query_alloc_block_size, trans_prealloc_size, trans_alloc_block_size
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc32
1 files changed, 28 insertions, 4 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 693d8e4c958..475beb798e6 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -88,6 +88,8 @@ static void fix_myisam_max_sort_file_size(THD *thd, enum_var_type type);
static void fix_max_binlog_size(THD *thd, enum_var_type type);
static void fix_max_relay_log_size(THD *thd, enum_var_type type);
static void fix_max_connections(THD *thd, enum_var_type type);
+static void fix_thd_mem_root(THD *thd, enum_var_type type);
+static void fix_trans_mem_root(THD *thd, enum_var_type type);
/*
Variable definition list
@@ -209,13 +211,17 @@ sys_var_long_ptr sys_query_cache_size("query_cache_size",
sys_var_thd_ulong sys_range_alloc_block_size("range_alloc_block_size",
&SV::range_alloc_block_size);
sys_var_thd_ulong sys_query_alloc_block_size("query_alloc_block_size",
- &SV::query_alloc_block_size);
+ &SV::query_alloc_block_size,
+ fix_thd_mem_root);
sys_var_thd_ulong sys_query_prealloc_size("query_prealloc_size",
- &SV::query_prealloc_size);
+ &SV::query_prealloc_size,
+ fix_thd_mem_root);
sys_var_thd_ulong sys_trans_alloc_block_size("transaction_alloc_block_size",
- &SV::trans_alloc_block_size);
+ &SV::trans_alloc_block_size,
+ fix_trans_mem_root);
sys_var_thd_ulong sys_trans_prealloc_size("transaction_prealloc_size",
- &SV::trans_prealloc_size);
+ &SV::trans_prealloc_size,
+ fix_trans_mem_root);
#ifdef HAVE_QUERY_CACHE
sys_var_long_ptr sys_query_cache_limit("query_cache_limit",
@@ -763,6 +769,24 @@ static void fix_max_connections(THD *thd, enum_var_type type)
}
+static void fix_thd_mem_root(THD *thd, enum_var_type type)
+{
+ if (type != OPT_GLOBAL)
+ reset_root_defaults(&thd->mem_root,
+ thd->variables.query_alloc_block_size,
+ thd->variables.query_prealloc_size);
+}
+
+
+static void fix_trans_mem_root(THD *thd, enum_var_type type)
+{
+ if (type != OPT_GLOBAL)
+ reset_root_defaults(&thd->transaction.mem_root,
+ thd->variables.trans_alloc_block_size,
+ thd->variables.trans_prealloc_size);
+}
+
+
bool sys_var_long_ptr::update(THD *thd, set_var *var)
{
ulonglong tmp= var->value->val_int();