diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysqld.cc | 3 | ||||
-rw-r--r-- | sql/rpl_rli.h | 9 | ||||
-rw-r--r-- | sql/set_var.cc | 7 | ||||
-rw-r--r-- | sql/set_var.h | 1 | ||||
-rw-r--r-- | sql/sql_array.h | 5 | ||||
-rw-r--r-- | sql/sql_plugin.cc | 10 | ||||
-rw-r--r-- | sql/sql_select.cc | 35 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 | ||||
-rw-r--r-- | sql/sql_window.cc | 3 | ||||
-rw-r--r-- | sql/sql_window.h | 2 |
10 files changed, 48 insertions, 29 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f5ed61446f7..a67cea47fc9 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -9427,7 +9427,8 @@ static int get_options(int *argc_ptr, char ***argv_ptr) /* prepare all_options array */ my_init_dynamic_array(&all_options, sizeof(my_option), - array_elements(my_long_options), + array_elements(my_long_options) + + sys_var_elements(), array_elements(my_long_options)/4, MYF(0)); add_many_options(&all_options, my_long_options, array_elements(my_long_options)); sys_var_add_options(&all_options, 0); diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index e896c189a8e..3eaee90d0f6 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -347,10 +347,11 @@ public: rpl_parallel parallel; /* - The relay_log_state keeps track of the current binlog state of the execution - of the relay log. This is used to know where to resume current GTID position - if the slave thread is stopped and restarted. - It is only accessed from the SQL thread, so it does not need any locking. + The relay_log_state keeps track of the current binlog state of the + execution of the relay log. This is used to know where to resume + current GTID position if the slave thread is stopped and + restarted. It is only accessed from the SQL thread, so it does + not need any locking. */ rpl_binlog_state relay_log_state; /* diff --git a/sql/set_var.cc b/sql/set_var.cc index b5430c56865..5392a0065ac 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -64,7 +64,7 @@ int sys_var_init() /* Must be already initialized. */ DBUG_ASSERT(system_charset_info != NULL); - if (my_hash_init(&system_variable_hash, system_charset_info, 100, 0, + if (my_hash_init(&system_variable_hash, system_charset_info, 700, 0, 0, (my_hash_get_key) get_sys_var_length, 0, HASH_UNIQUE)) goto error; @@ -78,6 +78,11 @@ error: DBUG_RETURN(1); } +uint sys_var_elements() +{ + return system_variable_hash.records; +} + int sys_var_add_options(DYNAMIC_ARRAY *long_options, int parse_flags) { uint saved_elements= long_options->elements; diff --git a/sql/set_var.h b/sql/set_var.h index cf86ecf18fa..060a4e1a57c 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -414,6 +414,7 @@ extern sys_var *Sys_autocommit_ptr; CHARSET_INFO *get_old_charset_by_name(const char *old_name); int sys_var_init(); +uint sys_var_elements(); int sys_var_add_options(DYNAMIC_ARRAY *long_options, int parse_flags); void sys_var_end(void); diff --git a/sql/sql_array.h b/sql/sql_array.h index 7d6854690e7..bbaa653b177 100644 --- a/sql/sql_array.h +++ b/sql/sql_array.h @@ -239,6 +239,11 @@ public: delete_dynamic(&array); } + void free_memory() + { + delete_dynamic(&array); + } + typedef int (*CMP_FUNC)(const Elem *el1, const Elem *el2); void sort(CMP_FUNC cmp_func) diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index dbe19674cf2..f540c268923 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1544,22 +1544,26 @@ int plugin_init(int *argc, char **argv, int flags) init_alloc_root(&plugin_vars_mem_root, 4096, 4096, MYF(0)); init_alloc_root(&tmp_root, 4096, 4096, MYF(0)); - if (my_hash_init(&bookmark_hash, &my_charset_bin, 16, 0, 0, + if (my_hash_init(&bookmark_hash, &my_charset_bin, 32, 0, 0, get_bookmark_hash_key, NULL, HASH_UNIQUE)) goto err; mysql_mutex_init(key_LOCK_plugin, &LOCK_plugin, MY_MUTEX_INIT_FAST); + /* + The 80 is from 2016-04-27 when we had 71 default plugins + Big enough to avoid many mallocs even in future + */ if (my_init_dynamic_array(&plugin_dl_array, sizeof(struct st_plugin_dl *), 16, 16, MYF(0)) || my_init_dynamic_array(&plugin_array, - sizeof(struct st_plugin_int *), 16, 16, MYF(0))) + sizeof(struct st_plugin_int *), 80, 32, MYF(0))) goto err; for (i= 0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++) { - if (my_hash_init(&plugin_hash[i], system_charset_info, 16, 0, 0, + if (my_hash_init(&plugin_hash[i], system_charset_info, 32, 0, 0, get_plugin_hash_key, NULL, HASH_UNIQUE)) goto err; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index a8be787fac4..a6bbfc806e1 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2017,7 +2017,7 @@ JOIN::optimize_inner() TODO: Explain the quick_group part of the test below. */ if ((ordered_index_usage != ordered_index_group_by) && - (tmp_table_param.quick_group && !procedure || + ((tmp_table_param.quick_group && !procedure) || (tab->emb_sj_nest && best_positions[const_tables].sj_strategy == SJ_OPT_LOOSE_SCAN))) { @@ -3123,7 +3123,7 @@ void JOIN::save_explain_data(Explain_query *output, bool can_overwrite, Explain_union *eu= output->get_union(nr); explain= &eu->fake_select_lex_explain; join_tab[0].tracker= eu->get_fake_select_lex_tracker(); - for (int i=0 ; i < top_join_tab_count + aggr_tables; i++) + for (uint i=0 ; i < top_join_tab_count + aggr_tables; i++) { if (join_tab[i].filesort) { @@ -3360,23 +3360,25 @@ JOIN::destroy() cleanup(1); - uint tables= table_count+aggr_tables; - - if (join_tab) // We should not have tables > 0 and join_tab != NULL - for (JOIN_TAB *tab= first_linear_tab(this, WITH_BUSH_ROOTS, WITH_CONST_TABLES); - tab; tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS)) + if (join_tab) { - if (tab->aggr) + DBUG_ASSERT(table_count+aggr_tables > 0); + for (JOIN_TAB *tab= first_linear_tab(this, WITH_BUSH_ROOTS, + WITH_CONST_TABLES); + tab; tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS)) { - free_tmp_table(thd, tab->table); - delete tab->tmp_table_param; - tab->tmp_table_param= NULL; - tab->aggr= NULL; + if (tab->aggr) + { + free_tmp_table(thd, tab->table); + delete tab->tmp_table_param; + tab->tmp_table_param= NULL; + tab->aggr= NULL; + } + tab->table= NULL; } - - tab->table= NULL; } - /* Cleanup items referencing temporary table columns */ + + /* Cleanup items referencing temporary table columns */ cleanup_item_list(tmp_all_fields1); cleanup_item_list(tmp_all_fields3); destroy_sj_tmp_tables(this); @@ -24426,9 +24428,6 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, DBUG_ENTER("select_describe"); /* Update the QPF with latest values of using_temporary, using_filesort */ - Explain_select *explain_sel; - uint select_nr= join->select_lex->select_number; - for (SELECT_LEX_UNIT *unit= join->select_lex->first_inner_unit(); unit; unit= unit->next_unit()) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index aa2b47fa4b7..1102050e29c 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3044,7 +3044,7 @@ int add_status_vars(SHOW_VAR *list) if (status_vars_inited) mysql_mutex_lock(&LOCK_show_status); if (!all_status_vars.buffer && // array is not allocated yet - do it now - my_init_dynamic_array(&all_status_vars, sizeof(SHOW_VAR), 200, 20, MYF(0))) + my_init_dynamic_array(&all_status_vars, sizeof(SHOW_VAR), 250, 50, MYF(0))) { res= 1; goto err; diff --git a/sql/sql_window.cc b/sql/sql_window.cc index d8aa79130a4..e3e42fc4f75 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -577,6 +577,8 @@ class Rowid_seq_cursor uint ref_length; public: + virtual ~Rowid_seq_cursor() {} + void init(READ_RECORD *info) { cache_start= info->cache_pos; @@ -631,6 +633,7 @@ class Table_read_cursor : public Rowid_seq_cursor */ READ_RECORD *read_record; public: + virtual ~Table_read_cursor() {} void init(READ_RECORD *info) { diff --git a/sql/sql_window.h b/sql/sql_window.h index e109ef316ee..54e39d827fe 100644 --- a/sql/sql_window.h +++ b/sql/sql_window.h @@ -89,8 +89,8 @@ public: class Window_spec : public Sql_alloc { bool window_names_are_checked; - public: + virtual ~Window_spec() {} LEX_STRING *window_ref; |