Commit b43ee49b authored by Sergei Golubchik's avatar Sergei Golubchik

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
parent c03deada
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment