From b6d27e20e19e1998b745a438dbde635261ebc5d4 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 2 Aug 2003 02:43:18 -0700 Subject: Many files: Added key cache assignment mi_locking.c: Added key cache assignment: correction my_sys.h: Added key cache variable structure include/my_sys.h: Added key cache variable structure include/my_base.h: Added key cache assignment include/myisam.h: Added key cache assignment include/my_global.h: Added key cache assignment isam/_page.c: Added key cache assignment isam/close.c: Added key cache assignment isam/isamchk.c: Added key cache assignment isam/isamlog.c: Added key cache assignment isam/panic.c: Added key cache assignment isam/_locking.c: Added key cache assignment isam/test2.c: Added key cache assignment isam/test3.c: Added key cache assignment myisam/myisamdef.h: Added key cache assignment myisam/mi_check.c: Added key cache assignment myisam/mi_close.c: Added key cache assignment myisam/mi_extra.c: Added key cache assignment myisam/mi_page.c: Added key cache assignment myisam/mi_panic.c: Added key cache assignment myisam/mi_preload.c: Added key cache assignment myisam/mi_test1.c: Added key cache assignment myisam/mi_test2.c: Added key cache assignment myisam/mi_test3.c: Added key cache assignment myisam/myisamchk.c: Added key cache assignment myisam/myisamlog.c: Added key cache assignment myisam/mi_delete_all.c: Added key cache assignment myisam/mi_locking.c: Added key cache assignment: correction myisam/mi_keycache.c: Added key cache assignment sql/handler.h: Added key cache assignment sql/mysql_priv.h: Added key cache assignment sql/set_var.h: Added key cache assignment sql/table.h: Added key cache assignment sql/ha_myisam.cc: Added key cache assignment sql/ha_myisammrg.cc: Added key cache assignment sql/handler.cc: Added key cache assignment sql/mysqld.cc: Added key cache assignment sql/set_var.cc: Added key cache assignment sql/sql_base.cc: Added key cache assignment sql/sql_table.cc: Added key cache assignment sql/sql_test.cc: Added key cache assignment sql/sql_yacc.yy: Added key cache assignment mysys/mf_keycache.c: Added key cache assignment mysql-test/t/key_cache.test: Added key cache assignment mysql-test/r/key_cache.result: Added key cache assignment --- sql/set_var.h | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'sql/set_var.h') diff --git a/sql/set_var.h b/sql/set_var.h index 978aba3384a..f057041f30d 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -29,6 +29,8 @@ class sys_var; class set_var; typedef struct system_variables SV; extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib; +extern uint dflt_key_cache_block_size; +extern ulong dflt_key_buff_size; enum enum_var_type { @@ -529,15 +531,43 @@ public: }; -class sys_var_key_buffer_size :public sys_var +class sys_var_key_cache_param :public sys_var { +protected: + uint offset; public: - sys_var_key_buffer_size(const char *name_arg) + sys_var_key_cache_param(const char *name_arg) :sys_var(name_arg) - {} + { + offset= 0; + } + byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); +}; + +class sys_var_key_buffer_size :public sys_var_key_cache_param +{ +public: + sys_var_key_buffer_size(const char *name_arg) + :sys_var_key_cache_param(name_arg) + { + offset= offsetof(KEY_CACHE_VAR, buff_size); + } bool update(THD *thd, set_var *var); SHOW_TYPE type() { return SHOW_LONGLONG; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + bool check_default(enum_var_type type) { return 1; } + bool is_struct() { return 1; } +}; + +class sys_var_key_cache_block_size :public sys_var_key_cache_param +{ +public: + sys_var_key_cache_block_size(const char *name_arg) + :sys_var_key_cache_param(name_arg) + { + offset= offsetof(KEY_CACHE_VAR, block_size); + } + bool update(THD *thd, set_var *var); + SHOW_TYPE type() { return SHOW_LONG; } bool check_default(enum_var_type type) { return 1; } bool is_struct() { return 1; } }; @@ -709,5 +739,6 @@ gptr find_named(I_List *list, const char *name, uint length); void delete_elements(I_List *list, void (*free_element)(gptr)); /* key_cache functions */ -KEY_CACHE *get_or_create_key_cache(const char *name, uint length); +KEY_CACHE_VAR *get_or_create_key_cache(const char *name, uint length); void free_key_cache(gptr key_cache); +bool process_key_caches(int (* func) (KEY_CACHE_VAR *)); -- cgit v1.2.1 From cbd85f9deb0f407dcb50bd818b20e16aa77e6b2b Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 9 Aug 2003 11:12:22 -0700 Subject: set_var.cc, mysqld.cc, handler.cc, set_var.h, handler.h: Added key cache parameters for midpoint insertion strategy Many files: Added midpoint insertion strategy for key cache mi_test2.c: Added a parameter to resize_key_cache mysys/mf_keycache.c: Added midpoint insertion strategy for key cache myisam/mi_check.c: Added midpoint insertion strategy for key cache myisam/mi_page.c: Added midpoint insertion strategy for key cache myisam/mi_range.c: Added midpoint insertion strategy for key cache myisam/rt_index.c: Added midpoint insertion strategy for key cache myisam/rt_split.c: Added midpoint insertion strategy for key cache myisam/mi_delete.c: Added midpoint insertion strategy for key cache myisam/mi_preload.c: Added midpoint insertion strategy for key cache myisam/mi_search.c: Added midpoint insertion strategy for key cache myisam/mi_write.c: Added midpoint insertion strategy for key cache myisam/rt_key.c: Added midpoint insertion strategy for key cache myisam/mi_test2.c: Added a parameter to resize_key_cache isam/_page.c: Added midpoint insertion strategy for key cache include/my_sys.h: Added midpoint insertion strategy for key cache myisam/myisamdef.h: Added midpoint insertion strategy for key cache sql/handler.h: Added key cache parameters for midpoint insertion strategy. sql/set_var.h: Added key cache parameters for midpoint insertion strategy. sql/handler.cc: Added key cache parameters for midpoint insertion strategy. sql/mysqld.cc: Added key cache parameters for midpoint insertion strategy. sql/set_var.cc: Added key cache parameters for midpoint insertion strategy. --- sql/set_var.h | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'sql/set_var.h') diff --git a/sql/set_var.h b/sql/set_var.h index f057041f30d..aed47a64955 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -29,8 +29,11 @@ class sys_var; class set_var; typedef struct system_variables SV; extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib; + +extern ulonglong dflt_key_buff_size; extern uint dflt_key_cache_block_size; -extern ulong dflt_key_buff_size; +extern uint dflt_key_cache_division_limit; +extern uint dflt_key_cache_age_threshold; enum enum_var_type { @@ -572,6 +575,34 @@ public: bool is_struct() { return 1; } }; +class sys_var_key_cache_division_limit :public sys_var_key_cache_param +{ +public: + sys_var_key_cache_division_limit(const char *name_arg) + :sys_var_key_cache_param(name_arg) + { + offset= offsetof(KEY_CACHE_VAR, division_limit); + } + bool update(THD *thd, set_var *var); + SHOW_TYPE type() { return SHOW_LONG; } + bool check_default(enum_var_type type) { return 1; } + bool is_struct() { return 1; } +}; + +class sys_var_key_cache_age_threshold :public sys_var_key_cache_param +{ +public: + sys_var_key_cache_age_threshold(const char *name_arg) + :sys_var_key_cache_param(name_arg) + { + offset= offsetof(KEY_CACHE_VAR, age_threshold); + } + bool update(THD *thd, set_var *var); + SHOW_TYPE type() { return SHOW_LONG; } + bool check_default(enum_var_type type) { return 1; } + bool is_struct() { return 1; } +}; + /* Variable that you can only read from */ -- cgit v1.2.1 From 09e7be1d821831eee3bdeb0126a92aa7c23bed7d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Oct 2003 20:20:17 -0700 Subject: Manual merge after improving concurrency for key cache reassignment --- sql/set_var.h | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 5 deletions(-) (limited to 'sql/set_var.h') diff --git a/sql/set_var.h b/sql/set_var.h index 812bd6c9420..76db478c50d 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -30,6 +30,11 @@ class set_var; typedef struct system_variables SV; extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib; +extern ulonglong dflt_key_buff_size; +extern uint dflt_key_cache_block_size; +extern uint dflt_key_cache_division_limit; +extern uint dflt_key_cache_age_threshold; + enum enum_var_type { OPT_DEFAULT, OPT_SESSION, OPT_GLOBAL @@ -541,15 +546,71 @@ public: byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; -class sys_var_key_buffer_size :public sys_var +class sys_var_key_cache_param :public sys_var { +protected: + uint offset; public: - sys_var_key_buffer_size(const char *name_arg) + sys_var_key_cache_param(const char *name_arg) :sys_var(name_arg) - {} + { + offset= 0; + } + byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); +}; + +class sys_var_key_buffer_size :public sys_var_key_cache_param +{ +public: + sys_var_key_buffer_size(const char *name_arg) + :sys_var_key_cache_param(name_arg) + { + offset= offsetof(KEY_CACHE_VAR, buff_size); + } bool update(THD *thd, set_var *var); SHOW_TYPE type() { return SHOW_LONGLONG; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + bool check_default(enum_var_type type) { return 1; } + bool is_struct() { return 1; } +}; + +class sys_var_key_cache_block_size :public sys_var_key_cache_param +{ +public: + sys_var_key_cache_block_size(const char *name_arg) + :sys_var_key_cache_param(name_arg) + { + offset= offsetof(KEY_CACHE_VAR, block_size); + } + bool update(THD *thd, set_var *var); + SHOW_TYPE type() { return SHOW_LONG; } + bool check_default(enum_var_type type) { return 1; } + bool is_struct() { return 1; } +}; + +class sys_var_key_cache_division_limit :public sys_var_key_cache_param +{ +public: + sys_var_key_cache_division_limit(const char *name_arg) + :sys_var_key_cache_param(name_arg) + { + offset= offsetof(KEY_CACHE_VAR, division_limit); + } + bool update(THD *thd, set_var *var); + SHOW_TYPE type() { return SHOW_LONG; } + bool check_default(enum_var_type type) { return 1; } + bool is_struct() { return 1; } +}; + +class sys_var_key_cache_age_threshold :public sys_var_key_cache_param +{ +public: + sys_var_key_cache_age_threshold(const char *name_arg) + :sys_var_key_cache_param(name_arg) + { + offset= offsetof(KEY_CACHE_VAR, age_threshold); + } + bool update(THD *thd, set_var *var); + SHOW_TYPE type() { return SHOW_LONG; } bool check_default(enum_var_type type) { return 1; } bool is_struct() { return 1; } }; @@ -734,5 +795,6 @@ gptr find_named(I_List *list, const char *name, uint length, void delete_elements(I_List *list, void (*free_element)(gptr)); /* key_cache functions */ -KEY_CACHE *get_or_create_key_cache(const char *name, uint length); +KEY_CACHE_VAR *get_or_create_key_cache(const char *name, uint length); void free_key_cache(gptr key_cache); +bool process_key_caches(int (* func) (KEY_CACHE_VAR *)); -- cgit v1.2.1