diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-05-02 08:44:17 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-05-02 08:44:17 +0200 |
commit | ca091e6372c4d1b05d2338e878042c2914519a4e (patch) | |
tree | 406c71091eb4fdf4409147d22e6749309f677e8e /sql | |
parent | 28325b08633372cc343dfcbc41fe252020cf6e6e (diff) | |
parent | d233fd14a39f9c583b85ffb03e42b5ea52e2f4c2 (diff) | |
download | mariadb-git-ca091e6372c4d1b05d2338e878042c2914519a4e.tar.gz |
Merge branch '10.1' into 10.2
Diffstat (limited to 'sql')
-rw-r--r-- | sql/event_scheduler.cc | 4 | ||||
-rw-r--r-- | sql/gen_win_tzname_data.ps1 | 2 | ||||
-rw-r--r-- | sql/opt_range.cc | 34 | ||||
-rw-r--r-- | sql/slave.cc | 1 | ||||
-rw-r--r-- | sql/sql_class.cc | 5 | ||||
-rw-r--r-- | sql/sql_lex.cc | 18 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/win_tzname_data.h | 8 |
8 files changed, 46 insertions, 28 deletions
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index f680163c49a..2a5399fb94a 100644 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -1,4 +1,5 @@ -/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. +/* Copyright (c) 2006, 2019, Oracle and/or its affiliates. + Copyright (c) 2009, 2020, MariaDB Corporation 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 @@ -497,6 +498,7 @@ Event_scheduler::run(THD *thd) DBUG_PRINT("info", ("job_data is NULL, the thread was killed")); } DBUG_PRINT("info", ("state=%s", scheduler_states_names[state].str)); + free_root(thd->mem_root, MYF(0)); } LOCK_DATA(); diff --git a/sql/gen_win_tzname_data.ps1 b/sql/gen_win_tzname_data.ps1 index 13b6ce6ffd0..c0a37d21895 100644 --- a/sql/gen_win_tzname_data.ps1 +++ b/sql/gen_win_tzname_data.ps1 @@ -4,7 +4,7 @@ write-output "/* This file was generated using gen_win_tzname_data.ps1 */" $xdoc = new-object System.Xml.XmlDocument -$xdoc.load("https://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml") +$xdoc.load("https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml") $nodes = $xdoc.SelectNodes("//mapZone[@territory='001']") # use default territory (001) foreach ($node in $nodes) { write-output ('{L"'+ $node.other + '","'+ $node.type+'"},') diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 2cf4311a83c..6a5f1c9f750 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -357,9 +357,8 @@ QUICK_RANGE_SELECT *get_quick_select(PARAM *param,uint index, uint mrr_buf_size, MEM_ROOT *alloc); static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, bool index_read_must_be_used, - bool update_tbl_stats, - double read_time, - bool ror_scans_required); + bool for_range_access, + double read_time); static TRP_INDEX_INTERSECT *get_best_index_intersect(PARAM *param, SEL_TREE *tree, double read_time); @@ -2593,7 +2592,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, /* Get best 'range' plan and prepare data for making other plans */ if ((range_trp= get_key_scans_params(¶m, tree, FALSE, TRUE, - best_read_time, FALSE))) + best_read_time))) { best_trp= range_trp; best_read_time= best_trp->read_cost; @@ -4680,7 +4679,6 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, double roru_index_costs; ha_rows roru_total_records; double roru_intersect_part= 1.0; - bool only_ror_scans_required= FALSE; size_t n_child_scans; DBUG_ENTER("get_best_disjunct_quick"); DBUG_PRINT("info", ("Full table scan cost: %g", read_time)); @@ -4708,8 +4706,6 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, n_child_scans))) DBUG_RETURN(NULL); - only_ror_scans_required= !optimizer_flag(param->thd, - OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION); /* Collect best 'range' scan for each of disjuncts, and, while doing so, analyze possibility of ROR scans. Also calculate some values needed by @@ -4722,8 +4718,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, DBUG_EXECUTE("info", print_sel_tree(param, *ptree, &(*ptree)->keys_map, "tree in SEL_IMERGE");); if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE, - read_time, - only_ror_scans_required))) + read_time))) { /* One of index scans in this index_merge is more expensive than entire @@ -5043,9 +5038,12 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge, a random order 2. the functions that estimate the cost of a range scan and an index merge retrievals are not well calibrated + + As the best range access has been already chosen it does not + make sense to evaluate the one obtained from a degenerated + index merge. */ - trp= get_key_scans_params(param, *imerge->trees, FALSE, TRUE, - read_time, FALSE); + trp= 0; } DBUG_RETURN(trp); @@ -6772,9 +6770,9 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, tree make range select for this SEL_TREE index_read_must_be_used if TRUE, assume 'index only' option will be set (except for clustered PK indexes) + for_range_access if TRUE the function is called to get the best range + plan for range access, not for index merge access read_time don't create read plans with cost > read_time. - only_ror_scans_required set to TRUE when we are only interested - in ROR scan RETURN Best range read plan NULL if no plan found or error occurred @@ -6782,9 +6780,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, bool index_read_must_be_used, - bool update_tbl_stats, - double read_time, - bool only_ror_scans_required) + bool for_range_access, + double read_time) { uint idx, UNINIT_VAR(best_idx); SEL_ARG *key_to_read= NULL; @@ -6829,10 +6826,11 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, (bool) param->table->covering_keys.is_set(keynr); found_records= check_quick_select(param, idx, read_index_only, key, - update_tbl_stats, &mrr_flags, + for_range_access, &mrr_flags, &buf_size, &cost); - if (only_ror_scans_required && !param->is_ror_scan) + if (!for_range_access && !param->is_ror_scan && + !optimizer_flag(param->thd,OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION)) { /* The scan is not a ROR-scan, just skip it */ continue; diff --git a/sql/slave.cc b/sql/slave.cc index a5dc4395d51..eb95afd140b 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -4454,6 +4454,7 @@ connected: goto err; goto connected; } + DBUG_EXECUTE_IF("fail_com_register_slave", goto err;); } DBUG_PRINT("info",("Starting reading binary log from master")); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 494498cad55..38770a24dec 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -71,6 +71,7 @@ #ifdef HAVE_SYS_SYSCALL_H #include <sys/syscall.h> #endif +#include "repl_failsafe.h" /* The following is used to initialise Table_ident with a internal @@ -1417,6 +1418,10 @@ void THD::cleanup(void) DBUG_ASSERT(!mdl_context.has_locks()); apc_target.destroy(); +#ifdef HAVE_REPLICATION + unregister_slave(this, true, true); +#endif + cleanup_done=1; DBUG_VOID_RETURN; } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index b0d43358b6e..2312ec34e7b 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2018, MariaDB Corporation +/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. + Copyright (c) 2009, 2020, MariaDB Corporation 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 @@ -1190,17 +1190,27 @@ static inline uint int_token(const char *str,uint length) */ bool consume_comment(Lex_input_stream *lip, int remaining_recursions_permitted) { + // only one level of nested comments are allowed + DBUG_ASSERT(remaining_recursions_permitted == 0 || + remaining_recursions_permitted == 1); uchar c; while (! lip->eof()) { c= lip->yyGet(); - if (remaining_recursions_permitted > 0) + if (remaining_recursions_permitted == 1) { if ((c == '/') && (lip->yyPeek() == '*')) { + lip->yyUnput('('); // Replace nested "/*..." with "(*..." + lip->yySkip(); // and skip "(" + lip->yySkip(); /* Eat asterisk */ - consume_comment(lip, remaining_recursions_permitted-1); + if (consume_comment(lip, 0)) + return true; + + lip->yyUnput(')'); // Replace "...*/" with "...*)" + lip->yySkip(); // and skip ")" continue; } } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3f03f27e21c..13576daae98 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2082,7 +2082,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, general_log_print(thd, command, "Log: '%s' Pos: %lu", name, pos); if (nlen < FN_REFLEN) mysql_binlog_send(thd, thd->strmake(name, nlen), (my_off_t)pos, flags); - unregister_slave(thd,1,1); + unregister_slave(thd, true, true); // todo: can be extraneous /* fake COM_QUIT -- if we get here, the thread needs to terminate */ error = TRUE; break; diff --git a/sql/win_tzname_data.h b/sql/win_tzname_data.h index 28a14ab7c11..03197227f8e 100644 --- a/sql/win_tzname_data.h +++ b/sql/win_tzname_data.h @@ -23,13 +23,13 @@ {L"Haiti Standard Time","America/Port-au-Prince"}, {L"Cuba Standard Time","America/Havana"}, {L"US Eastern Standard Time","America/Indianapolis"}, +{L"Turks And Caicos Standard Time","America/Grand_Turk"}, {L"Paraguay Standard Time","America/Asuncion"}, {L"Atlantic Standard Time","America/Halifax"}, {L"Venezuela Standard Time","America/Caracas"}, {L"Central Brazilian Standard Time","America/Cuiaba"}, {L"SA Western Standard Time","America/La_Paz"}, {L"Pacific SA Standard Time","America/Santiago"}, -{L"Turks And Caicos Standard Time","America/Grand_Turk"}, {L"Newfoundland Standard Time","America/St_Johns"}, {L"Tocantins Standard Time","America/Araguaina"}, {L"E. South America Standard Time","America/Sao_Paulo"}, @@ -46,11 +46,11 @@ {L"UTC","Etc/GMT"}, {L"GMT Standard Time","Europe/London"}, {L"Greenwich Standard Time","Atlantic/Reykjavik"}, +{L"Sao Tome Standard Time","Africa/Sao_Tome"}, +{L"Morocco Standard Time","Africa/Casablanca"}, {L"W. Europe Standard Time","Europe/Berlin"}, {L"Central Europe Standard Time","Europe/Budapest"}, {L"Romance Standard Time","Europe/Paris"}, -{L"Morocco Standard Time","Africa/Casablanca"}, -{L"Sao Tome Standard Time","Africa/Sao_Tome"}, {L"Central European Standard Time","Europe/Warsaw"}, {L"W. Central Africa Standard Time","Africa/Lagos"}, {L"Jordan Standard Time","Asia/Amman"}, @@ -81,11 +81,13 @@ {L"Mauritius Standard Time","Indian/Mauritius"}, {L"Saratov Standard Time","Europe/Saratov"}, {L"Georgian Standard Time","Asia/Tbilisi"}, +{L"Volgograd Standard Time","Europe/Volgograd"}, {L"Caucasus Standard Time","Asia/Yerevan"}, {L"Afghanistan Standard Time","Asia/Kabul"}, {L"West Asia Standard Time","Asia/Tashkent"}, {L"Ekaterinburg Standard Time","Asia/Yekaterinburg"}, {L"Pakistan Standard Time","Asia/Karachi"}, +{L"Qyzylorda Standard Time","Asia/Qyzylorda"}, {L"India Standard Time","Asia/Calcutta"}, {L"Sri Lanka Standard Time","Asia/Colombo"}, {L"Nepal Standard Time","Asia/Katmandu"}, |