diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 341c9039390..6e848695b80 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -761,7 +761,23 @@ DROP VIEW v1; DROP PROCEDURE p1; DROP FUNCTION f1; ---echo End of 5.0 tests. +# +# Bug #28808: log_queries_not_using_indexes variable dynamic change is ignored +# +flush status; +show variables like "log_queries_not_using_indexes"; +select 1 from information_schema.tables limit 1; +show status like 'slow_queries'; +set global log_queries_not_using_indexes=OFF; +show variables like "log_queries_not_using_indexes"; +select 1 from information_schema.tables limit 1; +show status like 'slow_queries'; +set global log_queries_not_using_indexes=ON; +show variables like "log_queries_not_using_indexes"; +select 1 from information_schema.tables limit 1; +show status like 'slow_queries'; + +--echo End of 5.0 tests --disable_result_log SHOW AUTHORS; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 10ae466fe4d..6d22047b9db 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7820,8 +7820,6 @@ static void get_options(int *argc,char **argv) if (opt_short_log_format) opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT; - if (opt_log_queries_not_using_indexes) - opt_specialflag|= SPECIAL_LOG_QUERIES_NOT_USING_INDEXES; if (init_global_datetime_format(MYSQL_TIMESTAMP_DATE, &global_system_variables.date_format) || diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index aa661b64598..000a0a30de6 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1323,7 +1323,7 @@ void log_slow_statement(THD *thd) thd->variables.long_query_time || ((thd->server_status & (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) && - (specialflag & SPECIAL_LOG_QUERIES_NOT_USING_INDEXES))) + opt_log_queries_not_using_indexes)) { thd->status_var.long_query_count++; slow_log_print(thd, thd->query, thd->query_length, start_of_query); diff --git a/sql/unireg.h b/sql/unireg.h index 5b73c6e9caa..6c26f30f116 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -124,7 +124,7 @@ #define SPECIAL_NO_HOST_CACHE 512 /* Don't cache hosts */ #define SPECIAL_SHORT_LOG_FORMAT 1024 #define SPECIAL_SAFE_MODE 2048 -#define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Log q not using indexes */ +#define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */ /* Extern defines */ #define store_record(A,B) bmove_align((A)->B,(A)->record[0],(size_t) (A)->s->reclength)