summaryrefslogtreecommitdiff
path: root/sql/sys_vars.h
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-12-21 23:40:26 +0100
committerSergei Golubchik <sergii@pisem.net>2011-12-21 23:40:26 +0100
commitb43ee49b4e8674102669ac841f29f66283d193d5 (patch)
tree03ef067e645a9304387347cf7784a489a3838d62 /sql/sys_vars.h
parentc03deada6c0caa1b919608c3c4bdb4115d735cd7 (diff)
downloadmariadb-git-b43ee49b4e8674102669ac841f29f66283d193d5.tar.gz
keycache sysvars used to pass incorrect offset into the parent constructor,
that caused the default value to be written into an arbitrary location inside global_system_variables
Diffstat (limited to 'sql/sys_vars.h')
-rw-r--r--sql/sys_vars.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sys_vars.h b/sql/sys_vars.h
index e7c03bbf552..272506ff1b5 100644
--- a/sql/sys_vars.h
+++ b/sql/sys_vars.h
@@ -669,7 +669,7 @@ public:
};
#endif
-#define KEYCACHE_VAR(X) sys_var::GLOBAL,offsetof(KEY_CACHE, X), sizeof(((KEY_CACHE *)0)->X)
+#define KEYCACHE_VAR(X) GLOBAL_VAR(dflt_key_cache_var.X)
#define keycache_var_ptr(KC, OFF) (((uchar*)(KC))+(OFF))
#define keycache_var(KC, OFF) (*(ulonglong*)keycache_var_ptr(KC, OFF))
typedef bool (*keycache_update_function)(THD *, KEY_CACHE *, ptrdiff_t, ulonglong);
@@ -706,7 +706,8 @@ public:
{
option.var_type|= GET_ASK_ADDR;
option.value= (uchar**)1; // crash me, please
- keycache_var(dflt_key_cache, off)= def_val;
+ // fix an offset from global_system_variables to be an offset in KEY_CACHE
+ offset= global_var_ptr() - (uchar*)dflt_key_cache;
SYSVAR_ASSERT(scope() == GLOBAL);
}
bool global_update(THD *thd, set_var *var)