diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-04-25 16:05:20 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-04-25 16:05:20 +0300 |
commit | e6bdf77e4be48750c4808a09af197ed91fd69a61 (patch) | |
tree | 2ca921747b9ae7b01835efe9609799b27efb1387 /sql | |
parent | 1599825ffc2c942f8b63274a9556b425229375c7 (diff) | |
parent | acf6f92aa936fbfe7524617ae57d011ab8f1f96d (diff) | |
download | mariadb-git-e6bdf77e4be48750c4808a09af197ed91fd69a61.tar.gz |
Merge 10.3 into 10.4
In is_eits_usable(), we disable an assertion that fails due to
MDEV-19334.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/gcalc_slicescan.cc | 2 | ||||
-rw-r--r-- | sql/handler.cc | 1 | ||||
-rw-r--r-- | sql/item_func.cc | 2 | ||||
-rw-r--r-- | sql/semisync_master.cc | 27 | ||||
-rw-r--r-- | sql/semisync_master.h | 7 | ||||
-rw-r--r-- | sql/sp_head.cc | 3 | ||||
-rw-r--r-- | sql/sql_class.h | 3 | ||||
-rw-r--r-- | sql/sql_lex.cc | 20 | ||||
-rw-r--r-- | sql/sql_parse.cc | 15 | ||||
-rw-r--r-- | sql/sql_select.cc | 3 | ||||
-rw-r--r-- | sql/sql_show.cc | 8 | ||||
-rw-r--r-- | sql/sql_statistics.cc | 8 | ||||
-rw-r--r-- | sql/sql_string.h | 5 | ||||
-rw-r--r-- | sql/sql_update.cc | 3 | ||||
-rw-r--r-- | sql/sql_window.cc | 16 |
15 files changed, 84 insertions, 39 deletions
diff --git a/sql/gcalc_slicescan.cc b/sql/gcalc_slicescan.cc index 9127bb95aeb..3a5dc6410a8 100644 --- a/sql/gcalc_slicescan.cc +++ b/sql/gcalc_slicescan.cc @@ -993,6 +993,8 @@ void Gcalc_heap::reset() { if (m_n_points) { + if (m_hook) + *m_hook= NULL; free_list(m_first); m_n_points= 0; } diff --git a/sql/handler.cc b/sql/handler.cc index ee881d92337..130ddfd56eb 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2194,6 +2194,7 @@ int ha_recover(HASH *commit_list) for (info.len= MAX_XID_LIST_SIZE ; info.list==0 && info.len > MIN_XID_LIST_SIZE; info.len/=2) { + DBUG_EXECUTE_IF("min_xa_len", info.len = 16;); info.list=(XID *)my_malloc(info.len*sizeof(XID), MYF(0)); } if (!info.list) diff --git a/sql/item_func.cc b/sql/item_func.cc index 704c4897f01..04fa20a8abf 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2009, 2017, MariaDB + Copyright (c) 2009, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/semisync_master.cc b/sql/semisync_master.cc index 8a82fd9085c..4e37e3af58d 100644 --- a/sql/semisync_master.cc +++ b/sql/semisync_master.cc @@ -228,7 +228,7 @@ bool Active_tranx::is_tranx_end_pos(const char *log_file_name, DBUG_RETURN(entry != NULL); } -int Active_tranx::clear_active_tranx_nodes(const char *log_file_name, +void Active_tranx::clear_active_tranx_nodes(const char *log_file_name, my_off_t log_file_pos) { Tranx_node *new_front; @@ -307,7 +307,7 @@ int Active_tranx::clear_active_tranx_nodes(const char *log_file_name, m_trx_front->log_name, (ulong)m_trx_front->log_pos)); } - DBUG_RETURN(0); + DBUG_VOID_RETURN; } @@ -371,20 +371,21 @@ int Repl_semi_sync_master::init_object() { result = enable_master(); if (!result) + { result= ack_receiver.start(); /* Start the ACK thread. */ + /* + If rpl_semi_sync_master_wait_no_slave is disabled, let's temporarily + switch off semisync to avoid hang if there's none active slave. + */ + if (!rpl_semi_sync_master_wait_no_slave) + switch_off(); + } } else { result = disable_master(); } - /* - If rpl_semi_sync_master_wait_no_slave is disabled, let's temporarily - switch off semisync to avoid hang if there's none active slave. - */ - if (!rpl_semi_sync_master_wait_no_slave) - switch_off(); - return result; } @@ -961,17 +962,15 @@ int Repl_semi_sync_master::commit_trx(const char* trx_wait_binlog_name, * the current sending event catches up with last wait position. If it * does match, semi-sync will be switched on again. */ -int Repl_semi_sync_master::switch_off() +void Repl_semi_sync_master::switch_off() { - int result; - DBUG_ENTER("Repl_semi_sync_master::switch_off"); m_state = false; /* Clear the active transaction list. */ assert(m_active_tranxs != NULL); - result = m_active_tranxs->clear_active_tranx_nodes(NULL, 0); + m_active_tranxs->clear_active_tranx_nodes(NULL, 0); rpl_semi_sync_master_off_times++; m_wait_file_name_inited = false; @@ -979,7 +978,7 @@ int Repl_semi_sync_master::switch_off() sql_print_information("Semi-sync replication switched OFF."); cond_broadcast(); /* wake up all waiting threads */ - DBUG_RETURN(result); + DBUG_VOID_RETURN; } int Repl_semi_sync_master::try_switch_on(int server_id, diff --git a/sql/semisync_master.h b/sql/semisync_master.h index 3b05d9e0348..de5e3240802 100644 --- a/sql/semisync_master.h +++ b/sql/semisync_master.h @@ -343,11 +343,8 @@ public: * position. * If log_file_name is NULL, everything will be cleared: the sorted * list and the hash table will be reset to empty. - * - * Return: - * 0: success; non-zero: error */ - int clear_active_tranx_nodes(const char *log_file_name, + void clear_active_tranx_nodes(const char *log_file_name, my_off_t log_file_pos); /* Given a position, check to see whether the position is an active @@ -449,7 +446,7 @@ class Repl_semi_sync_master } /* Switch semi-sync off because of timeout in transaction waiting. */ - int switch_off(); + void switch_off(); /* Switch semi-sync on when slaves catch up. */ int try_switch_on(int server_id, diff --git a/sql/sp_head.cc b/sql/sp_head.cc index e98e5fbc27e..f996c057908 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -181,6 +181,7 @@ sp_get_flags_for_command(LEX *lex) case SQLCOM_SHOW_EXPLAIN: case SQLCOM_SHOW_FIELDS: case SQLCOM_SHOW_FUNC_CODE: + case SQLCOM_SHOW_GENERIC: case SQLCOM_SHOW_GRANTS: case SQLCOM_SHOW_ENGINE_STATUS: case SQLCOM_SHOW_ENGINE_LOGS: @@ -3213,7 +3214,7 @@ sp_head::show_routine_code(THD *thd) const char *format= "Instruction at position %u has m_ip=%u"; char tmp[sizeof(format) + 2*SP_INSTR_UINT_MAXLEN + 1]; - sprintf(tmp, format, ip, i->m_ip); + my_snprintf(tmp, sizeof(tmp), format, ip, i->m_ip); /* Since this is for debugging purposes only, we don't bother to introduce a special error code for it. diff --git a/sql/sql_class.h b/sql/sql_class.h index 9e51f45126a..da21b9cb108 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2428,6 +2428,9 @@ public: */ bool create_tmp_table_for_derived; + /* The flag to force reading statistics from EITS tables */ + bool force_read_stats; + bool save_prep_leaf_list; /* container for handler's private per-connection data */ diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 8ea0bc50956..4a69e0bd1c7 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1659,9 +1659,27 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd) return(FLOAT_NUM); } } + /* + We've found: + - A sequence of digits + - Followed by 'e' or 'E' + - Followed by some byte XX which is not a known mantissa start, + and it's known to be a valid identifier part. + XX can be either a 8bit identifier character, or a multi-byte head. + */ yyUnget(); + return scan_ident_start(thd, &yylval->ident_cli); } - // fall through + /* + We've found: + - A sequence of digits + - Followed by some character XX, which is neither 'e' nor 'E', + and it's known to be a valid identifier part. + XX can be a 8bit identifier character, or a multi-byte head. + */ + yyUnget(); + return scan_ident_start(thd, &yylval->ident_cli); + case MY_LEX_IDENT_START: // We come here after '.' return scan_ident_start(thd, &yylval->ident_cli); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 0a476f47988..5f1867bd5c0 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2975,15 +2975,14 @@ static bool do_execute_sp(THD *thd, sp_head *sp) my_error(ER_SP_BADSELECT, MYF(0), ErrConvDQName(sp).ptr()); return 1; } - /* - If SERVER_MORE_RESULTS_EXISTS is not set, - then remember that it should be cleared - */ - bits_to_be_cleared= (~thd->server_status & - SERVER_MORE_RESULTS_EXISTS); - thd->server_status|= SERVER_MORE_RESULTS_EXISTS; } - + /* + If SERVER_MORE_RESULTS_EXISTS is not set, + then remember that it should be cleared + */ + bits_to_be_cleared= (~thd->server_status & + SERVER_MORE_RESULTS_EXISTS); + thd->server_status|= SERVER_MORE_RESULTS_EXISTS; ha_rows select_limit= thd->variables.select_limit; thd->variables.select_limit= HA_POS_ERROR; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index df582a1cd14..088d6224d6b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3725,7 +3725,8 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields, if (setup_sum_funcs(thd, sum_funcs)) goto err; - if (!group_list && !table->distinct && order && simple_order) + if (!group_list && !table->distinct && order && simple_order && + tab == join_tab + const_tables) { DBUG_PRINT("info",("Sorting for order")); THD_STAGE_INFO(thd, stage_sorting_for_order); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 7253f33f769..4d904199efc 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2009, 2017, MariaDB + Copyright (c) 2009, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -4640,7 +4640,10 @@ fill_schema_table_by_open(THD *thd, MEM_ROOT *mem_root, } DBUG_ASSERT(thd->lex == lex); + thd->force_read_stats= get_schema_table_idx(schema_table) == SCH_STATISTICS; result= open_tables_only_view_structure(thd, table_list, can_deadlock); + (void) read_statistics_for_tables_if_needed(thd, table_list); + thd->force_read_stats= false; DEBUG_SYNC(thd, "after_open_table_ignore_flush"); @@ -6302,7 +6305,8 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table, sph= Sp_handler::handler_mysql_proc((stored_procedure_type) proc_table->field[MYSQL_PROC_MYSQL_TYPE]-> val_int()); - if (!sph) + if (!sph || sph->type() == TYPE_ENUM_PACKAGE || + sph->type() == TYPE_ENUM_PACKAGE_BODY) DBUG_RETURN(0); if (!full_access) diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 944fa5dc176..e4cc00f45ba 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -2215,7 +2215,10 @@ inline bool statistics_for_command_is_needed(THD *thd) { if (thd->bootstrap || thd->variables.use_stat_tables == NEVER) return FALSE; - + + if (thd->force_read_stats) + return TRUE; + switch(thd->lex->sql_command) { case SQLCOM_SELECT: case SQLCOM_INSERT: @@ -4148,6 +4151,9 @@ bool is_eits_usable(Field *field) partition list of a table. We assume the selecticivity for such columns would be handled during partition pruning. */ +#if 0 /* Work around MDEV-19334 */ + DBUG_ASSERT(field->table->stats_is_read); +#endif Column_statistics* col_stats= field->read_stats; return col_stats && !col_stats->no_stat_values_provided() && //(1) field->type() != MYSQL_TYPE_GEOMETRY && //(2) diff --git a/sql/sql_string.h b/sql/sql_string.h index fa941c8156e..39555020696 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -977,11 +977,6 @@ public: { length(0); } - StringBuffer(const char *str, size_t length_arg, CHARSET_INFO *cs) - : String(buff, buff_sz, cs) - { - set(str, length_arg, cs); - } }; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 775a77c82d2..cf1b5ac3892 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -403,6 +403,8 @@ int mysql_update(THD *thd, if (lock_tables(thd, table_list, table_count, 0)) DBUG_RETURN(1); + (void) read_statistics_for_tables_if_needed(thd, table_list); + THD_STAGE_INFO(thd, stage_init_update); if (table_list->handle_derived(thd->lex, DT_MERGE_FOR_INSERT)) DBUG_RETURN(1); @@ -1807,6 +1809,7 @@ int mysql_multi_update_prepare(THD *thd) { DBUG_RETURN(TRUE); } + (void) read_statistics_for_tables_if_needed(thd, table_list); /* @todo: downgrade the metadata locks here. */ /* diff --git a/sql/sql_window.cc b/sql/sql_window.cc index dcc6a7bac1c..86c40b5f58f 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -455,6 +455,22 @@ int compare_order_lists(SQL_I_List<ORDER> *part_list1, for ( ; elem1 && elem2; elem1= elem1->next, elem2= elem2->next) { int cmp; + // remove all constants as we don't need them for comparision + while(elem1 && ((*elem1->item)->real_item())->const_item()) + { + elem1= elem1->next; + continue; + } + + while(elem2 && ((*elem2->item)->real_item())->const_item()) + { + elem2= elem2->next; + continue; + } + + if (!elem1 || !elem2) + break; + if ((cmp= compare_order_elements(elem1, elem2))) return cmp; } |