From 697dbd15e0102f33fba1d1d6d9aa964b638f9534 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sun, 4 Dec 2022 10:47:31 +1100 Subject: MDEV-21187: log_slow_filter="" logs queries not using indexes Consistent with MDEV-4206 and empty log_slow_filter still means no explict filtering. Since 21518ab2e453 however the log_queries_not_using_indexes became stored in the same variable. As we need to test for the absense of log_queries_not_using_indexes the SERVER_QUERY_NO_INDEX USED part of log_slow_statement, the empty criteria resulted in an always true to log queries not using indexes if log_slow_filter was set to empty. Adjusted the log_slow.test for MDEV-4206 as slow_log_query has been global and session for a while and it was relying on the MDEV-21187 buggy behavior to detect a slow query. Reviewer: Monty --- sql/sql_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_parse.cc') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 385360168a1..cf316c8cc1c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2513,7 +2513,7 @@ void log_slow_statement(THD *thd) if ((thd->server_status & (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) && !(thd->query_plan_flags & QPLAN_STATUS) && - !slow_filter_masked(thd, QPLAN_NOT_USING_INDEX)) + (thd->variables.log_slow_filter & QPLAN_NOT_USING_INDEX)) { thd->query_plan_flags|= QPLAN_NOT_USING_INDEX; /* We are always logging no index queries if enabled in filter */ -- cgit v1.2.1 From 5e3c948cc9e02c8504340e38568d109ac8c8e2ab Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Nov 2022 18:22:19 +0100 Subject: MDEV-29852 SIGSEGV in mysql_create_routine or is_acl_user on 2nd execution, ASAN use-after-poison in get_current_user (sql_acl.cc) if lex->definer is replaced, take care to restore it at the end of PS EXECUTE --- sql/sql_parse.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sql/sql_parse.cc') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 39b364e475d..6e99eca2eb1 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2800,9 +2800,10 @@ bool sp_process_definer(THD *thd) } else { - LEX_USER *d= lex->definer= get_current_user(thd, lex->definer); + LEX_USER *d= get_current_user(thd, lex->definer); if (!d) DBUG_RETURN(TRUE); + thd->change_item_tree((Item**)&lex->definer, (Item*)d); /* If the specified definer differs from the current user or role, we -- cgit v1.2.1 From ca23558a0561856cc7f3c1ab5db4025102482380 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 12 Dec 2022 13:18:46 +0100 Subject: --skip-name-resolve=0 didn't work custom code in `case OPT_SKIP_RESOLVE` was overriding the correct value from handle_options(). --- sql/sql_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_parse.cc') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index cf316c8cc1c..3102aa69b86 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5248,7 +5248,7 @@ mysql_execute_command(THD *thd) List_iterator user_list(lex->users_list); while ((user= user_list++)) { - if (specialflag & SPECIAL_NO_RESOLVE && + if (opt_skip_name_resolve && hostname_requires_resolving(user->host.str)) push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WARN_HOSTNAME_WONT_WORK, -- cgit v1.2.1