Commit 0e0a7011 authored by Kristofer Pettersson's avatar Kristofer Pettersson

Merge changeset

parents 8ab6a300 82cdce24
This diff is collapsed.
...@@ -10,6 +10,21 @@ ...@@ -10,6 +10,21 @@
--disable_ps_protocol --disable_ps_protocol
use mysql; use mysql;
# Capture initial settings of system variables
# so that we can revert to old state after manipulation for testing
# NOTE: PLEASE USE THESE VALUES TO 'RESET' SYSTEM VARIABLES
# Capturing old values within the tests results in loss of values
# due to people not paying attention to previous tests' changes, captures
# or improper cleanup
SET @saved_long_query_time = @@long_query_time;
SET @saved_log_output = @@log_output;
SET @saved_general_log = @@GLOBAL.general_log;
SET @saved_slow_query_log = @@GLOBAL.slow_query_log;
SELECT @saved_long_query_time, @saved_log_output, @saved_general_log, @saved_slow_query_log;
# #
# Check that log tables work and we can do basic selects. This also # Check that log tables work and we can do basic selects. This also
# tests truncate, which works in a special mode with the log tables # tests truncate, which works in a special mode with the log tables
...@@ -161,6 +176,7 @@ set session long_query_time=1; ...@@ -161,6 +176,7 @@ set session long_query_time=1;
select sleep(2); select sleep(2);
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME --replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
select * from mysql.slow_log; select * from mysql.slow_log;
set @@session.long_query_time = @saved_long_query_time;
# #
# Bug #18559 log tables cannot change engine, and gets deadlocked when # Bug #18559 log tables cannot change engine, and gets deadlocked when
...@@ -305,6 +321,7 @@ unlock tables; ...@@ -305,6 +321,7 @@ unlock tables;
# Bug #21785 Server crashes after rename of the log table # Bug #21785 Server crashes after rename of the log table
# #
SET SESSION long_query_time = 1000;
--disable_warnings --disable_warnings
drop table if exists mysql.renamed_general_log; drop table if exists mysql.renamed_general_log;
drop table if exists mysql.renamed_slow_log; drop table if exists mysql.renamed_slow_log;
...@@ -365,6 +382,7 @@ set global slow_query_log='ON'; ...@@ -365,6 +382,7 @@ set global slow_query_log='ON';
RENAME TABLE general_log2 TO general_log; RENAME TABLE general_log2 TO general_log;
RENAME TABLE slow_log2 TO slow_log; RENAME TABLE slow_log2 TO slow_log;
SET SESSION long_query_time = @saved_long_query_time;
# this should work # this should work
set global general_log='ON'; set global general_log='ON';
...@@ -476,8 +494,6 @@ ALTER TABLE mysql.general_log ENGINE = CSV; ...@@ -476,8 +494,6 @@ ALTER TABLE mysql.general_log ENGINE = CSV;
## test the slow query log ## test the slow query log
SET @old_long_query_time:=@@long_query_time;
SET GLOBAL slow_query_log = 0; SET GLOBAL slow_query_log = 0;
FLUSH LOGS; FLUSH LOGS;
...@@ -503,12 +519,14 @@ SELECT "My own slow query", sleep(2); ...@@ -503,12 +519,14 @@ SELECT "My own slow query", sleep(2);
SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3; SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3;
SET GLOBAL slow_query_log = 0; SET GLOBAL slow_query_log = 0;
SET SESSION long_query_time =@old_long_query_time; SET SESSION long_query_time =@saved_long_query_time;
FLUSH LOGS; FLUSH LOGS;
ALTER TABLE mysql.slow_log DROP COLUMN seq; ALTER TABLE mysql.slow_log DROP COLUMN seq;
ALTER TABLE mysql.slow_log ENGINE = CSV; ALTER TABLE mysql.slow_log ENGINE = CSV;
SET GLOBAL slow_query_log = @saved_slow_query_log;
# #
# Bug#25422 (Hang with log tables) # Bug#25422 (Hang with log tables)
# #
...@@ -790,9 +808,6 @@ END // ...@@ -790,9 +808,6 @@ END //
DELIMITER ;// DELIMITER ;//
SET @old_general_log_state = @@global.general_log;
SET @old_slow_log_state = @@global.slow_query_log;
SET GLOBAL general_log = ON; SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON; SET GLOBAL slow_query_log = ON;
...@@ -814,8 +829,8 @@ DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`; ...@@ -814,8 +829,8 @@ DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`; DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
DROP DATABASE IF EXISTS `db_17876`; DROP DATABASE IF EXISTS `db_17876`;
SET GLOBAL general_log = @old_general_log_state; SET GLOBAL general_log = @saved_general_log;
SET GLOBAL slow_query_log = @old_slow_log_state; SET GLOBAL slow_query_log = @saved_slow_query_log;
# #
# Bug#21557 entries in the general query log truncated at 1000 characters. # Bug#21557 entries in the general query log truncated at 1000 characters.
...@@ -823,7 +838,6 @@ SET GLOBAL slow_query_log = @old_slow_log_state; ...@@ -823,7 +838,6 @@ SET GLOBAL slow_query_log = @old_slow_log_state;
select CONNECTION_ID() into @thread_id; select CONNECTION_ID() into @thread_id;
truncate table mysql.general_log; truncate table mysql.general_log;
set @old_general_log_state = @@global.general_log;
set global general_log = on; set global general_log = on;
--disable_result_log --disable_result_log
set @lparam = "000 001 002 003 004 005 006 007 008 009" set @lparam = "000 001 002 003 004 005 006 007 008 009"
...@@ -934,7 +948,7 @@ execute long_query using @lparam; ...@@ -934,7 +948,7 @@ execute long_query using @lparam;
set global general_log = off; set global general_log = off;
select command_type, argument from mysql.general_log where thread_id = @thread_id; select command_type, argument from mysql.general_log where thread_id = @thread_id;
deallocate prepare long_query; deallocate prepare long_query;
set global general_log = @old_general_log_state; set global general_log = @saved_general_log;
# #
# Bug#34306: Can't make copy of log tables when server binary log is enabled # Bug#34306: Can't make copy of log tables when server binary log is enabled
...@@ -948,9 +962,6 @@ DROP TABLE IF EXISTS general_log_copy; ...@@ -948,9 +962,6 @@ DROP TABLE IF EXISTS general_log_copy;
CREATE TABLE log_count (count BIGINT(21)); CREATE TABLE log_count (count BIGINT(21));
SET @old_general_log_state = @@global.general_log;
SET @old_slow_log_state = @@global.slow_query_log;
SET GLOBAL general_log = ON; SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON; SET GLOBAL slow_query_log = ON;
...@@ -977,15 +988,14 @@ INSERT INTO general_log_copy SELECT * FROM mysql.general_log; ...@@ -977,15 +988,14 @@ INSERT INTO general_log_copy SELECT * FROM mysql.general_log;
INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log)); INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log));
DROP TABLE general_log_copy; DROP TABLE general_log_copy;
SET GLOBAL general_log = @old_general_log_state; SET GLOBAL general_log = @saved_general_log;
SET GLOBAL slow_query_log = @old_slow_log_state; SET GLOBAL slow_query_log = @saved_slow_query_log;
DROP TABLE log_count; DROP TABLE log_count;
# #
# Bug #31700: thd->examined_row_count not incremented for 'const' type queries # Bug #31700: thd->examined_row_count not incremented for 'const' type queries
# #
SET @old_slow_log_state = @@global.slow_query_log;
SET SESSION long_query_time = 0; SET SESSION long_query_time = 0;
SET GLOBAL slow_query_log = ON; SET GLOBAL slow_query_log = ON;
...@@ -1010,5 +1020,10 @@ DROP TABLE t1; ...@@ -1010,5 +1020,10 @@ DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
SET GLOBAL slow_query_log = @old_slow_log_state; # RESET altered system variables before exiting the test
SET SESSION long_query_time =@old_long_query_time; SET GLOBAL slow_query_log = @saved_slow_query_log;
SET GLOBAL general_log=@saved_general_log;
SET SESSION long_query_time =@saved_long_query_time;
SET GLOBAL LOG_OUTPUT = @saved_log_output;
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