Commit 4f88fafd authored by unknown's avatar unknown

Bug #30000: SHOW commands once again ends up in the

 slow query log
Disable the SHOW commands to appear in the show query
log.
Update the commands type array.


mysql-test/r/show_check.result:
  Bug #30000: test case
mysql-test/t/show_check.test:
  Bug #30000: test case
sql/sql_parse.cc:
  Bug #30000: skip SHOW commands from the
  slow query log.
parent 0fe81d1e
......@@ -790,13 +790,73 @@ show tables;
Tables_in_test
show status like 'slow_queries';
Variable_name Value
Slow_queries 1
Slow_queries 0
select 1 from information_schema.tables limit 1;
1
1
show status like 'slow_queries';
Variable_name Value
Slow_queries 2
Slow_queries 1
create table t1 (a int);
create trigger tr1 before insert on t1 for each row
begin
end;
create view v1 as select a from t1;
create procedure p1()
begin
end;
create function f1()
returns int
return 0;
create event e1 on schedule every 1 year starts now()
ends date_add(now(), interval 5 hour) do
begin
end;
flush status;
show databases;
show tables;
show events;
show table status;
show open tables;
show plugins;
show columns in t1;
show slave hosts;
show keys in t1;
show column types;
show table types;
show storage engines;
show authors;
show contributors;
show privileges;
show count(*) warnings;
show count(*) errors;
show warnings;
show status;
show processlist;
show variables;
show charset;
show collation;
show grants;
show create database test;
show create table t1;
show create view v1;
show master status;
show slave status;
show create procedure p1;
show create function f1;
show create trigger tr1;
show procedure status;
show procedure code p1;
show function code f1;
show create event e1;
show status like 'slow_queries';
Variable_name Value
Slow_queries 0
drop view v1;
drop table t1;
drop procedure p1;
drop function f1;
drop event e1;
DROP DATABASE IF EXISTS mysqltest1;
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
......@@ -1157,7 +1217,7 @@ select 1 from information_schema.tables limit 1;
1
show status like 'slow_queries';
Variable_name Value
Slow_queries 2
Slow_queries 1
set global log_queries_not_using_indexes=OFF;
show variables like "log_queries_not_using_indexes";
Variable_name Value
......@@ -1167,7 +1227,7 @@ select 1 from information_schema.tables limit 1;
1
show status like 'slow_queries';
Variable_name Value
Slow_queries 2
Slow_queries 1
set global log_queries_not_using_indexes=ON;
show variables like "log_queries_not_using_indexes";
Variable_name Value
......@@ -1177,7 +1237,7 @@ select 1 from information_schema.tables limit 1;
1
show status like 'slow_queries';
Variable_name Value
Slow_queries 4
Slow_queries 2
End of 5.0 tests
SHOW AUTHORS;
create database mysqltest;
......
......@@ -549,6 +549,70 @@ show status like 'slow_queries';
# (mysqld is started with --log-queries-not-using-indexes)
select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
create table t1 (a int);
create trigger tr1 before insert on t1 for each row
begin
end;
create view v1 as select a from t1;
create procedure p1()
begin
end;
create function f1()
returns int
return 0;
create event e1 on schedule every 1 year starts now()
ends date_add(now(), interval 5 hour) do
begin
end;
--disable_result_log
flush status;
show databases;
show tables;
show events;
show table status;
show open tables;
show plugins;
show columns in t1;
show slave hosts;
show keys in t1;
show column types;
show table types;
show storage engines;
show authors;
show contributors;
show privileges;
show count(*) warnings;
show count(*) errors;
show warnings;
show status;
show processlist;
show variables;
show charset;
show collation;
show grants;
show create database test;
show create table t1;
show create view v1;
show master status;
show slave status;
show create procedure p1;
show create function f1;
show create trigger tr1;
show procedure status;
show procedure code p1;
show function code f1;
show create event e1;
--enable_result_log
show status like 'slow_queries';
drop view v1;
drop table t1;
drop procedure p1;
drop function f1;
drop event e1;
#
# BUG#10491: Server returns data as charset binary SHOW CREATE TABLE or SELECT
# FROM I_S.
......
......@@ -223,7 +223,6 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_REPLACE_SELECT]= CF_CHANGES_DATA | CF_HAS_ROW_COUNT;
sql_command_flags[SQLCOM_SHOW_STATUS_PROC]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_STATUS_FUNC]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_STATUS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_DATABASES]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_TRIGGERS]= CF_STATUS_COMMAND;
......@@ -235,10 +234,36 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_SHOW_VARIABLES]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_CHARSETS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_COLLATIONS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_STATUS_PROC]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_TABLES]= (CF_STATUS_COMMAND |
CF_SHOW_TABLE_COMMAND);
sql_command_flags[SQLCOM_SHOW_NEW_MASTER]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_BINLOGS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_SLAVE_HOSTS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_BINLOG_EVENTS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_COLUMN_TYPES]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_STORAGE_ENGINES]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_AUTHORS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_CONTRIBUTORS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_PRIVILEGES]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_WARNS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_ERRORS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_ENGINE_STATUS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_ENGINE_MUTEX]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_ENGINE_LOGS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_PROCESSLIST]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_GRANTS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_CREATE_DB]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_CREATE]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_MASTER_STAT]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_SLAVE_STAT]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_CREATE_PROC]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_CREATE_FUNC]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_CREATE_TRIGGER]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_STATUS_FUNC]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_PROC_CODE]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_FUNC_CODE]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_CREATE_EVENT]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_TABLES]= (CF_STATUS_COMMAND |
CF_SHOW_TABLE_COMMAND);
sql_command_flags[SQLCOM_SHOW_TABLE_STATUS]= (CF_STATUS_COMMAND |
CF_SHOW_TABLE_COMMAND);
......@@ -1323,7 +1348,8 @@ 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)) &&
opt_log_queries_not_using_indexes))
opt_log_queries_not_using_indexes &&
!(sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND)))
{
thd->status_var.long_query_count++;
slow_log_print(thd, thd->query, thd->query_length, start_of_query);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment