# save SET @global_slow_query_log = @@global.slow_query_log; SET @global_log_output = @@global.log_output; ############################################################################### # Begin the functionality testing for slow_query_log # ############################################################################### SET @@session.long_query_time=1; SET @@global.log_output = 'TABLE'; #========================================= --echo '----When slow_query_log = OFF----' #========================================= SET @@global.slow_query_log = OFF; TRUNCATE mysql.slow_log; # The sleep is the slow query SELECT sleep(2); SELECT count(*) FROM mysql.slow_log; #========================================= --echo '----When slow_query_log = ON-----' #========================================= SET @@global.slow_query_log = ON; TRUNCATE mysql.slow_log; # The sleep is the slow query SELECT sleep(2) AS bug53630; SELECT count(*) > 0 FROM mysql.slow_log WHERE sql_text LIKE '% bug53630'; SELECT thread_id - connection_id() FROM mysql.slow_log WHERE sql_text LIKE '% bug53630' ORDER BY start_time DESC LIMIT 1; #========================================================================== --echo 'Bug#47905 stored procedures not logged correctly to slow query log' #========================================================================== # assumes logging to table turned on with long_query_time=1 as above TRUNCATE mysql.slow_log; DELIMITER //; CREATE PROCEDURE p_test() BEGIN select sleep(2); select 1; END// DELIMITER ;// CALL p_test(); SELECT count(*) > 0 FROM mysql.slow_log; DROP PROCEDURE p_test; SET sql_mode = default; #================================================================== Restore SET @@global.log_output = @global_log_output; SET @global.slow_query_log = @global_slow_query_log; TRUNCATE TABLE mysql.general_log; TRUNCATE TABLE mysql.slow_log; ############################################################################### # End of the functionality test for slow_query_log # ###############################################################################