mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
cleanup: main.log_tables test
This commit is contained in:
@ -1,14 +1,9 @@
|
|||||||
SET SQL_MODE="";
|
SET SQL_MODE="";
|
||||||
SET @old_general_log_state = @@global.general_log;
|
|
||||||
SET @old_log_output= @@global.log_output;
|
SET @old_log_output= @@global.log_output;
|
||||||
SET @old_slow_query_log= @@global.slow_query_log;
|
SET @old_slow_query_log= @@global.slow_query_log;
|
||||||
SET @old_general_log= @@global.general_log;
|
SET @old_general_log= @@global.general_log;
|
||||||
SET @old_long_query_time= @@session.long_query_time;
|
SET @old_long_query_time= @@session.long_query_time;
|
||||||
use mysql;
|
use mysql;
|
||||||
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;
|
|
||||||
truncate table general_log;
|
truncate table general_log;
|
||||||
select * from general_log;
|
select * from general_log;
|
||||||
event_time user_host thread_id server_id command_type argument
|
event_time user_host thread_id server_id command_type argument
|
||||||
@ -120,6 +115,9 @@ show open tables;
|
|||||||
Database Table In_use Name_locked
|
Database Table In_use Name_locked
|
||||||
SET GLOBAL GENERAL_LOG=ON;
|
SET GLOBAL GENERAL_LOG=ON;
|
||||||
SET GLOBAL SLOW_QUERY_LOG=ON;
|
SET GLOBAL SLOW_QUERY_LOG=ON;
|
||||||
|
#
|
||||||
|
# Bug#23924 general_log truncates queries with character set introducers.
|
||||||
|
#
|
||||||
truncate table mysql.general_log;
|
truncate table mysql.general_log;
|
||||||
set names binary;
|
set names binary;
|
||||||
select _koi8r'<27><><EFBFBD><EFBFBD>' as test;
|
select _koi8r'<27><><EFBFBD><EFBFBD>' as test;
|
||||||
@ -131,6 +129,9 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query set names binary
|
|||||||
TIMESTAMP USER_HOST THREAD_ID 1 Query select _koi8r'\xD4\xC5\xD3\xD4' as test
|
TIMESTAMP USER_HOST THREAD_ID 1 Query select _koi8r'\xD4\xC5\xD3\xD4' as test
|
||||||
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
|
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
|
||||||
set names utf8;
|
set names utf8;
|
||||||
|
#
|
||||||
|
# Bug #16905 Log tables: unicode statements are logged incorrectly
|
||||||
|
#
|
||||||
truncate table mysql.general_log;
|
truncate table mysql.general_log;
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table bug16905 (s char(15) character set utf8 default 'пусто');
|
create table bug16905 (s char(15) character set utf8 default 'пусто');
|
||||||
@ -142,6 +143,9 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query create table bug16905 (s char(15) characte
|
|||||||
TIMESTAMP USER_HOST THREAD_ID 1 Query insert into bug16905 values ('новое')
|
TIMESTAMP USER_HOST THREAD_ID 1 Query insert into bug16905 values ('новое')
|
||||||
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
|
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
|
||||||
drop table bug16905;
|
drop table bug16905;
|
||||||
|
#
|
||||||
|
# Bug #17600: Invalid data logged into mysql.slow_log
|
||||||
|
#
|
||||||
truncate table mysql.slow_log;
|
truncate table mysql.slow_log;
|
||||||
set session long_query_time=1;
|
set session long_query_time=1;
|
||||||
select sleep(2);
|
select sleep(2);
|
||||||
@ -150,7 +154,11 @@ sleep(2)
|
|||||||
select * from mysql.slow_log;
|
select * from mysql.slow_log;
|
||||||
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected
|
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected
|
||||||
TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 mysql 0 0 1 select sleep(2) THREAD_ID 0
|
TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 mysql 0 0 1 select sleep(2) THREAD_ID 0
|
||||||
set @@session.long_query_time = @saved_long_query_time;
|
set @@session.long_query_time = @old_long_query_time;
|
||||||
|
#
|
||||||
|
# Bug #18559 log tables cannot change engine, and gets deadlocked when
|
||||||
|
# dropping w/ log on
|
||||||
|
#
|
||||||
alter table mysql.general_log engine=myisam;
|
alter table mysql.general_log engine=myisam;
|
||||||
ERROR HY000: You cannot 'ALTER' a log table if logging is enabled
|
ERROR HY000: You cannot 'ALTER' a log table if logging is enabled
|
||||||
alter table mysql.slow_log engine=myisam;
|
alter table mysql.slow_log engine=myisam;
|
||||||
@ -232,7 +240,7 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query truncate table mysql.slow_log
|
|||||||
TIMESTAMP USER_HOST THREAD_ID 1 Query set session long_query_time=1
|
TIMESTAMP USER_HOST THREAD_ID 1 Query set session long_query_time=1
|
||||||
TIMESTAMP USER_HOST THREAD_ID 1 Query select sleep(2)
|
TIMESTAMP USER_HOST THREAD_ID 1 Query select sleep(2)
|
||||||
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.slow_log
|
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.slow_log
|
||||||
TIMESTAMP USER_HOST THREAD_ID 1 Query set @@session.long_query_time = @saved_long_query_time
|
TIMESTAMP USER_HOST THREAD_ID 1 Query set @@session.long_query_time = @old_long_query_time
|
||||||
TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.general_log engine=myisam
|
TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.general_log engine=myisam
|
||||||
TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.slow_log engine=myisam
|
TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.slow_log engine=myisam
|
||||||
TIMESTAMP USER_HOST THREAD_ID 1 Query drop table mysql.general_log
|
TIMESTAMP USER_HOST THREAD_ID 1 Query drop table mysql.general_log
|
||||||
@ -300,17 +308,20 @@ ON UPDATE CURRENT_TIMESTAMP,
|
|||||||
set global general_log='ON';
|
set global general_log='ON';
|
||||||
set global slow_query_log='ON';
|
set global slow_query_log='ON';
|
||||||
use test;
|
use test;
|
||||||
|
#
|
||||||
|
# Bug #20139 Infinite loop after "FLUSH" and "LOCK tabX, general_log"
|
||||||
|
#
|
||||||
flush tables with read lock;
|
flush tables with read lock;
|
||||||
unlock tables;
|
unlock tables;
|
||||||
use mysql;
|
use mysql;
|
||||||
lock tables general_log read local, help_category read local;
|
lock tables general_log read local, help_category read local;
|
||||||
ERROR HY000: You can't use locks with log tables
|
ERROR HY000: You can't use locks with log tables
|
||||||
unlock tables;
|
unlock tables;
|
||||||
|
#
|
||||||
|
# Bug #17544 Cannot do atomic log rotate and
|
||||||
|
# Bug #21785 Server crashes after rename of the log table
|
||||||
|
#
|
||||||
SET SESSION long_query_time = 1000;
|
SET SESSION long_query_time = 1000;
|
||||||
drop table if exists mysql.renamed_general_log;
|
|
||||||
drop table if exists mysql.renamed_slow_log;
|
|
||||||
drop table if exists mysql.general_log_new;
|
|
||||||
drop table if exists mysql.slow_log_new;
|
|
||||||
use mysql;
|
use mysql;
|
||||||
RENAME TABLE general_log TO renamed_general_log;
|
RENAME TABLE general_log TO renamed_general_log;
|
||||||
ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log'
|
ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log'
|
||||||
@ -356,13 +367,16 @@ set global slow_query_log='ON';
|
|||||||
ERROR 42S02: Table 'mysql.slow_log' doesn't exist
|
ERROR 42S02: Table 'mysql.slow_log' doesn't exist
|
||||||
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;
|
SET SESSION long_query_time = @old_long_query_time;
|
||||||
set global general_log='ON';
|
set global general_log='ON';
|
||||||
set global slow_query_log='ON';
|
set global slow_query_log='ON';
|
||||||
flush logs;
|
flush logs;
|
||||||
flush logs;
|
flush logs;
|
||||||
drop table renamed_general_log, renamed_slow_log;
|
drop table renamed_general_log, renamed_slow_log;
|
||||||
use test;
|
use test;
|
||||||
|
#
|
||||||
|
# Bug #21966 Strange warnings on repair of the log tables
|
||||||
|
#
|
||||||
use mysql;
|
use mysql;
|
||||||
repair table general_log;
|
repair table general_log;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
@ -380,6 +394,10 @@ slow_log
|
|||||||
slow_log_new
|
slow_log_new
|
||||||
drop table slow_log_new, general_log_new;
|
drop table slow_log_new, general_log_new;
|
||||||
use test;
|
use test;
|
||||||
|
#
|
||||||
|
# Bug#69953 / MDEV-4851
|
||||||
|
# Log tables should be modifable on LOG_OUTPUT != TABLE
|
||||||
|
#
|
||||||
SET GLOBAL LOG_OUTPUT = 'FILE';
|
SET GLOBAL LOG_OUTPUT = 'FILE';
|
||||||
SET GLOBAL slow_query_log = 1;
|
SET GLOBAL slow_query_log = 1;
|
||||||
SET GLOBAL general_log = 1;
|
SET GLOBAL general_log = 1;
|
||||||
@ -388,6 +406,10 @@ ALTER TABLE mysql.general_log ADD COLUMN comment_text TEXT NOT NULL;
|
|||||||
SET GLOBAL LOG_OUTPUT = 'NONE';
|
SET GLOBAL LOG_OUTPUT = 'NONE';
|
||||||
ALTER TABLE mysql.slow_log DROP COLUMN comment_text;
|
ALTER TABLE mysql.slow_log DROP COLUMN comment_text;
|
||||||
ALTER TABLE mysql.general_log DROP COLUMN comment_text;
|
ALTER TABLE mysql.general_log DROP COLUMN comment_text;
|
||||||
|
#
|
||||||
|
# Bug#27857 (Log tables supplies the wrong value for generating
|
||||||
|
# AUTO_INCREMENT numbers)
|
||||||
|
#
|
||||||
SET GLOBAL LOG_OUTPUT = 'TABLE';
|
SET GLOBAL LOG_OUTPUT = 'TABLE';
|
||||||
SET GLOBAL general_log = 0;
|
SET GLOBAL general_log = 0;
|
||||||
FLUSH LOGS;
|
FLUSH LOGS;
|
||||||
@ -451,16 +473,15 @@ START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own sl
|
|||||||
START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) THREAD_ID 0 3
|
START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) THREAD_ID 0 3
|
||||||
START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) THREAD_ID 0 4
|
START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) THREAD_ID 0 4
|
||||||
SET GLOBAL slow_query_log = 0;
|
SET GLOBAL slow_query_log = 0;
|
||||||
SET SESSION long_query_time =@saved_long_query_time;
|
SET SESSION long_query_time =@old_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 general_log = @old_general_log;
|
SET GLOBAL general_log = @old_general_log;
|
||||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||||
drop procedure if exists proc25422_truncate_slow;
|
#
|
||||||
drop procedure if exists proc25422_truncate_general;
|
# Bug#25422 (Hang with log tables)
|
||||||
drop procedure if exists proc25422_alter_slow;
|
#
|
||||||
drop procedure if exists proc25422_alter_general;
|
|
||||||
use test//
|
use test//
|
||||||
create procedure proc25422_truncate_slow (loops int)
|
create procedure proc25422_truncate_slow (loops int)
|
||||||
begin
|
begin
|
||||||
@ -485,26 +506,26 @@ end//
|
|||||||
create procedure proc25422_alter_slow (loops int)
|
create procedure proc25422_alter_slow (loops int)
|
||||||
begin
|
begin
|
||||||
declare v1 int default 0;
|
declare v1 int default 0;
|
||||||
|
declare old_log_state int default @@global.slow_query_log;
|
||||||
declare ER_BAD_LOG_STATEMENT condition for 1575;
|
declare ER_BAD_LOG_STATEMENT condition for 1575;
|
||||||
declare continue handler for ER_BAD_LOG_STATEMENT begin end;
|
declare continue handler for ER_BAD_LOG_STATEMENT begin end;
|
||||||
while v1 < loops do
|
while v1 < loops do
|
||||||
set @old_log_state = @@global.slow_query_log;
|
|
||||||
set global slow_query_log = 'OFF';
|
set global slow_query_log = 'OFF';
|
||||||
alter table mysql.slow_log engine = CSV;
|
alter table mysql.slow_log engine = CSV;
|
||||||
set global slow_query_log = @old_log_state;
|
set global slow_query_log = old_log_state;
|
||||||
set v1 = v1 + 1;
|
set v1 = v1 + 1;
|
||||||
end while;
|
end while;
|
||||||
end//
|
end//
|
||||||
create procedure proc25422_alter_general (loops int)
|
create procedure proc25422_alter_general (loops int)
|
||||||
begin
|
begin
|
||||||
declare v1 int default 0;
|
declare v1 int default 0;
|
||||||
|
declare old_log_state int default @@global.general_log;
|
||||||
declare ER_BAD_LOG_STATEMENT condition for 1575;
|
declare ER_BAD_LOG_STATEMENT condition for 1575;
|
||||||
declare continue handler for ER_BAD_LOG_STATEMENT begin end;
|
declare continue handler for ER_BAD_LOG_STATEMENT begin end;
|
||||||
while v1 < loops do
|
while v1 < loops do
|
||||||
set @old_log_state = @@global.general_log;
|
|
||||||
set global general_log = 'OFF';
|
set global general_log = 'OFF';
|
||||||
alter table mysql.general_log engine = CSV;
|
alter table mysql.general_log engine = CSV;
|
||||||
set global general_log = @old_log_state;
|
set global general_log = old_log_state;
|
||||||
set v1 = v1 + 1;
|
set v1 = v1 + 1;
|
||||||
end while;
|
end while;
|
||||||
end//
|
end//
|
||||||
@ -563,17 +584,19 @@ drop procedure proc25422_truncate_slow;
|
|||||||
drop procedure proc25422_truncate_general;
|
drop procedure proc25422_truncate_general;
|
||||||
drop procedure proc25422_alter_slow;
|
drop procedure proc25422_alter_slow;
|
||||||
drop procedure proc25422_alter_general;
|
drop procedure proc25422_alter_general;
|
||||||
|
#
|
||||||
|
# Bug#23044 (Warnings on flush of a log table)
|
||||||
|
#
|
||||||
FLUSH TABLE mysql.general_log;
|
FLUSH TABLE mysql.general_log;
|
||||||
show warnings;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
FLUSH TABLE mysql.slow_log;
|
FLUSH TABLE mysql.slow_log;
|
||||||
show warnings;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
DROP TABLE IF EXISTS `db_17876.slow_log_data`;
|
#
|
||||||
DROP TABLE IF EXISTS `db_17876.general_log_data`;
|
# Bug#17876 (Truncating mysql.slow_log in a SP after using cursor locks the
|
||||||
DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
|
# thread)
|
||||||
DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
|
#
|
||||||
DROP DATABASE IF EXISTS `db_17876`;
|
|
||||||
CREATE DATABASE db_17876;
|
CREATE DATABASE db_17876;
|
||||||
CREATE TABLE `db_17876.slow_log_data` (
|
CREATE TABLE `db_17876.slow_log_data` (
|
||||||
`start_time` timestamp(6) default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
`start_time` timestamp(6) default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||||
@ -686,6 +709,9 @@ 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;
|
SET GLOBAL general_log = @old_general_log;
|
||||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||||
|
#
|
||||||
|
# Bug#21557 entries in the general query log truncated at 1000 characters.
|
||||||
|
#
|
||||||
select CONNECTION_ID() into @thread_id;
|
select CONNECTION_ID() into @thread_id;
|
||||||
truncate table mysql.general_log;
|
truncate table mysql.general_log;
|
||||||
set global general_log = on;
|
set global general_log = on;
|
||||||
@ -902,9 +928,9 @@ Execute select '000 001 002 003 004 005 006 007 008 009010 011 012 013 014 015 0
|
|||||||
Query set global general_log = off
|
Query set global general_log = off
|
||||||
deallocate prepare long_query;
|
deallocate prepare long_query;
|
||||||
set global general_log = @old_general_log;
|
set global general_log = @old_general_log;
|
||||||
DROP TABLE IF EXISTS log_count;
|
#
|
||||||
DROP TABLE IF EXISTS slow_log_copy;
|
# Bug#34306: Can't make copy of log tables when server binary log is enabled
|
||||||
DROP TABLE IF EXISTS general_log_copy;
|
#
|
||||||
CREATE TABLE log_count (count BIGINT(21));
|
CREATE TABLE log_count (count BIGINT(21));
|
||||||
SET GLOBAL general_log = ON;
|
SET GLOBAL general_log = ON;
|
||||||
SET GLOBAL slow_query_log = ON;
|
SET GLOBAL slow_query_log = ON;
|
||||||
@ -926,9 +952,12 @@ CREATE TABLE general_log_copy SELECT * FROM mysql.general_log;
|
|||||||
INSERT INTO general_log_copy SELECT * FROM mysql.general_log;
|
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 = @saved_general_log;
|
SET GLOBAL general_log = @old_general_log;
|
||||||
SET GLOBAL slow_query_log = @saved_slow_query_log;
|
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||||
DROP TABLE log_count;
|
DROP TABLE log_count;
|
||||||
|
#
|
||||||
|
# Bug #31700: thd->examined_row_count not incremented for 'const' type queries
|
||||||
|
#
|
||||||
SET SESSION long_query_time = 0;
|
SET SESSION long_query_time = 0;
|
||||||
SET GLOBAL slow_query_log = ON;
|
SET GLOBAL slow_query_log = ON;
|
||||||
FLUSH LOGS;
|
FLUSH LOGS;
|
||||||
@ -954,9 +983,10 @@ TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1
|
|||||||
TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2
|
TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
TRUNCATE TABLE mysql.slow_log;
|
TRUNCATE TABLE mysql.slow_log;
|
||||||
|
#
|
||||||
|
# Bug #47924 main.log_tables times out sporadically
|
||||||
|
#
|
||||||
use mysql;
|
use mysql;
|
||||||
drop table if exists renamed_general_log;
|
|
||||||
drop table if exists renamed_slow_log;
|
|
||||||
RENAME TABLE general_log TO renamed_general_log;
|
RENAME TABLE general_log TO renamed_general_log;
|
||||||
ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log'
|
ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log'
|
||||||
RENAME TABLE slow_log TO renamed_slow_log;
|
RENAME TABLE slow_log TO renamed_slow_log;
|
||||||
@ -964,7 +994,6 @@ ERROR HY000: Cannot rename 'slow_log'. When logging enabled, rename to/from log
|
|||||||
use test;
|
use test;
|
||||||
flush tables with read lock;
|
flush tables with read lock;
|
||||||
unlock tables;
|
unlock tables;
|
||||||
SET @@session.long_query_time= @old_long_query_time;
|
|
||||||
SET @@global.log_output= @old_log_output;
|
SET @@global.log_output= @old_log_output;
|
||||||
SET @@global.slow_query_log= @old_slow_query_log;
|
SET @@global.slow_query_log= @old_slow_query_log;
|
||||||
SET @@global.general_log= @old_general_log;
|
SET @@global.general_log= @old_general_log;
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
# this test needs multithreaded mysqltest
|
# this test needs multithreaded mysqltest
|
||||||
-- source include/not_embedded.inc
|
-- source include/not_embedded.inc
|
||||||
#
|
|
||||||
# Basic log tables test
|
|
||||||
#
|
|
||||||
# check that CSV engine was compiled in
|
|
||||||
--source include/have_csv.inc
|
--source include/have_csv.inc
|
||||||
|
|
||||||
SET SQL_MODE="";
|
SET SQL_MODE="";
|
||||||
SET @old_general_log_state = @@global.general_log;
|
|
||||||
SET @old_log_output= @@global.log_output;
|
SET @old_log_output= @@global.log_output;
|
||||||
SET @old_slow_query_log= @@global.slow_query_log;
|
SET @old_slow_query_log= @@global.slow_query_log;
|
||||||
SET @old_general_log= @@global.general_log;
|
SET @old_general_log= @@global.general_log;
|
||||||
@ -16,16 +12,9 @@ SET @old_long_query_time= @@session.long_query_time;
|
|||||||
--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
|
# Basic log tables test
|
||||||
# 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;
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# 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
|
||||||
@ -147,9 +136,9 @@ show open tables;
|
|||||||
SET GLOBAL GENERAL_LOG=ON;
|
SET GLOBAL GENERAL_LOG=ON;
|
||||||
SET GLOBAL SLOW_QUERY_LOG=ON;
|
SET GLOBAL SLOW_QUERY_LOG=ON;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug#23924 general_log truncates queries with character set introducers.
|
--echo # Bug#23924 general_log truncates queries with character set introducers.
|
||||||
#
|
--echo #
|
||||||
truncate table mysql.general_log;
|
truncate table mysql.general_log;
|
||||||
set names binary;
|
set names binary;
|
||||||
select _koi8r'<27><><EFBFBD><EFBFBD>' as test;
|
select _koi8r'<27><><EFBFBD><EFBFBD>' as test;
|
||||||
@ -157,9 +146,9 @@ select _koi8r'
|
|||||||
select * from mysql.general_log;
|
select * from mysql.general_log;
|
||||||
set names utf8;
|
set names utf8;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug #16905 Log tables: unicode statements are logged incorrectly
|
--echo # Bug #16905 Log tables: unicode statements are logged incorrectly
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
truncate table mysql.general_log;
|
truncate table mysql.general_log;
|
||||||
set names utf8;
|
set names utf8;
|
||||||
@ -169,21 +158,21 @@ insert into bug16905 values ('новое');
|
|||||||
select * from mysql.general_log;
|
select * from mysql.general_log;
|
||||||
drop table bug16905;
|
drop table bug16905;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug #17600: Invalid data logged into mysql.slow_log
|
--echo # Bug #17600: Invalid data logged into mysql.slow_log
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
truncate table mysql.slow_log;
|
truncate table mysql.slow_log;
|
||||||
set session long_query_time=1;
|
set session long_query_time=1;
|
||||||
select sleep(2);
|
select sleep(2);
|
||||||
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME 12 THREAD_ID
|
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME 12 THREAD_ID
|
||||||
select * from mysql.slow_log;
|
select * from mysql.slow_log;
|
||||||
set @@session.long_query_time = @saved_long_query_time;
|
set @@session.long_query_time = @old_long_query_time;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug #18559 log tables cannot change engine, and gets deadlocked when
|
--echo # Bug #18559 log tables cannot change engine, and gets deadlocked when
|
||||||
# dropping w/ log on
|
--echo # dropping w/ log on
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
# check that appropriate error messages are given when one attempts to alter
|
# check that appropriate error messages are given when one attempts to alter
|
||||||
# or drop a log tables, while corresponding logs are enabled
|
# or drop a log tables, while corresponding logs are enabled
|
||||||
@ -322,9 +311,9 @@ set global general_log='ON';
|
|||||||
set global slow_query_log='ON';
|
set global slow_query_log='ON';
|
||||||
use test;
|
use test;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug #20139 Infinite loop after "FLUSH" and "LOCK tabX, general_log"
|
--echo # Bug #20139 Infinite loop after "FLUSH" and "LOCK tabX, general_log"
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
flush tables with read lock;
|
flush tables with read lock;
|
||||||
unlock tables;
|
unlock tables;
|
||||||
@ -333,18 +322,12 @@ use mysql;
|
|||||||
lock tables general_log read local, help_category read local;
|
lock tables general_log read local, help_category read local;
|
||||||
unlock tables;
|
unlock tables;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug #17544 Cannot do atomic log rotate and
|
--echo # Bug #17544 Cannot do atomic log rotate and
|
||||||
# Bug #21785 Server crashes after rename of the log table
|
--echo # Bug #21785 Server crashes after rename of the log table
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
SET SESSION long_query_time = 1000;
|
SET SESSION long_query_time = 1000;
|
||||||
--disable_warnings
|
|
||||||
drop table if exists mysql.renamed_general_log;
|
|
||||||
drop table if exists mysql.renamed_slow_log;
|
|
||||||
drop table if exists mysql.general_log_new;
|
|
||||||
drop table if exists mysql.slow_log_new;
|
|
||||||
--enable_warnings
|
|
||||||
|
|
||||||
use mysql;
|
use mysql;
|
||||||
# Should result in error
|
# Should result in error
|
||||||
@ -399,7 +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;
|
SET SESSION long_query_time = @old_long_query_time;
|
||||||
|
|
||||||
# this should work
|
# this should work
|
||||||
set global general_log='ON';
|
set global general_log='ON';
|
||||||
@ -427,13 +410,6 @@ use test;
|
|||||||
# TODO: improve filtering of expected errors in master.err in
|
# TODO: improve filtering of expected errors in master.err in
|
||||||
# mysql-test-run.pl (based on the test name ?), and uncomment this test.
|
# mysql-test-run.pl (based on the test name ?), and uncomment this test.
|
||||||
|
|
||||||
# --disable_warnings
|
|
||||||
# drop table if exists mysql.bad_general_log;
|
|
||||||
# drop table if exists mysql.bad_slow_log;
|
|
||||||
# drop table if exists mysql.general_log_hide;
|
|
||||||
# drop table if exists mysql.slow_log_hide;
|
|
||||||
# --enable_warnings
|
|
||||||
#
|
|
||||||
# create table mysql.bad_general_log (a int) engine= CSV;
|
# create table mysql.bad_general_log (a int) engine= CSV;
|
||||||
# create table mysql.bad_slow_log (a int) engine= CSV;
|
# create table mysql.bad_slow_log (a int) engine= CSV;
|
||||||
#
|
#
|
||||||
@ -459,9 +435,9 @@ use test;
|
|||||||
# drop table mysql.bad_general_log;
|
# drop table mysql.bad_general_log;
|
||||||
# drop table mysql.bad_slow_log;
|
# drop table mysql.bad_slow_log;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug #21966 Strange warnings on repair of the log tables
|
--echo # Bug #21966 Strange warnings on repair of the log tables
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
use mysql;
|
use mysql;
|
||||||
# check that no warning occurs on repair of the log tables
|
# check that no warning occurs on repair of the log tables
|
||||||
@ -474,11 +450,10 @@ show tables like "%log%";
|
|||||||
drop table slow_log_new, general_log_new;
|
drop table slow_log_new, general_log_new;
|
||||||
use test;
|
use test;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug#69953 / MDEV-4851
|
--echo # Bug#69953 / MDEV-4851
|
||||||
# Log tables should be modifable on LOG_OUTPUT != TABLE
|
--echo # Log tables should be modifable on LOG_OUTPUT != TABLE
|
||||||
#
|
--echo #
|
||||||
#
|
|
||||||
|
|
||||||
SET GLOBAL LOG_OUTPUT = 'FILE';
|
SET GLOBAL LOG_OUTPUT = 'FILE';
|
||||||
SET GLOBAL slow_query_log = 1;
|
SET GLOBAL slow_query_log = 1;
|
||||||
@ -492,10 +467,10 @@ ALTER TABLE mysql.slow_log DROP COLUMN comment_text;
|
|||||||
ALTER TABLE mysql.general_log DROP COLUMN comment_text;
|
ALTER TABLE mysql.general_log DROP COLUMN comment_text;
|
||||||
|
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug#27857 (Log tables supplies the wrong value for generating
|
--echo # Bug#27857 (Log tables supplies the wrong value for generating
|
||||||
# AUTO_INCREMENT numbers)
|
--echo # AUTO_INCREMENT numbers)
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
SET GLOBAL LOG_OUTPUT = 'TABLE';
|
SET GLOBAL LOG_OUTPUT = 'TABLE';
|
||||||
|
|
||||||
@ -554,7 +529,7 @@ 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 =@saved_long_query_time;
|
SET SESSION long_query_time =@old_long_query_time;
|
||||||
FLUSH LOGS;
|
FLUSH LOGS;
|
||||||
|
|
||||||
ALTER TABLE mysql.slow_log DROP COLUMN seq;
|
ALTER TABLE mysql.slow_log DROP COLUMN seq;
|
||||||
@ -563,16 +538,9 @@ ALTER TABLE mysql.slow_log ENGINE = CSV;
|
|||||||
SET GLOBAL general_log = @old_general_log;
|
SET GLOBAL general_log = @old_general_log;
|
||||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug#25422 (Hang with log tables)
|
--echo # Bug#25422 (Hang with log tables)
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
--disable_warnings
|
|
||||||
drop procedure if exists proc25422_truncate_slow;
|
|
||||||
drop procedure if exists proc25422_truncate_general;
|
|
||||||
drop procedure if exists proc25422_alter_slow;
|
|
||||||
drop procedure if exists proc25422_alter_general;
|
|
||||||
--enable_warnings
|
|
||||||
|
|
||||||
delimiter //;
|
delimiter //;
|
||||||
|
|
||||||
@ -602,14 +570,14 @@ end//
|
|||||||
create procedure proc25422_alter_slow (loops int)
|
create procedure proc25422_alter_slow (loops int)
|
||||||
begin
|
begin
|
||||||
declare v1 int default 0;
|
declare v1 int default 0;
|
||||||
|
declare old_log_state int default @@global.slow_query_log;
|
||||||
declare ER_BAD_LOG_STATEMENT condition for 1575;
|
declare ER_BAD_LOG_STATEMENT condition for 1575;
|
||||||
declare continue handler for ER_BAD_LOG_STATEMENT begin end;
|
declare continue handler for ER_BAD_LOG_STATEMENT begin end;
|
||||||
|
|
||||||
while v1 < loops do
|
while v1 < loops do
|
||||||
set @old_log_state = @@global.slow_query_log;
|
|
||||||
set global slow_query_log = 'OFF';
|
set global slow_query_log = 'OFF';
|
||||||
alter table mysql.slow_log engine = CSV;
|
alter table mysql.slow_log engine = CSV;
|
||||||
set global slow_query_log = @old_log_state;
|
set global slow_query_log = old_log_state;
|
||||||
set v1 = v1 + 1;
|
set v1 = v1 + 1;
|
||||||
end while;
|
end while;
|
||||||
end//
|
end//
|
||||||
@ -617,14 +585,14 @@ end//
|
|||||||
create procedure proc25422_alter_general (loops int)
|
create procedure proc25422_alter_general (loops int)
|
||||||
begin
|
begin
|
||||||
declare v1 int default 0;
|
declare v1 int default 0;
|
||||||
|
declare old_log_state int default @@global.general_log;
|
||||||
declare ER_BAD_LOG_STATEMENT condition for 1575;
|
declare ER_BAD_LOG_STATEMENT condition for 1575;
|
||||||
declare continue handler for ER_BAD_LOG_STATEMENT begin end;
|
declare continue handler for ER_BAD_LOG_STATEMENT begin end;
|
||||||
|
|
||||||
while v1 < loops do
|
while v1 < loops do
|
||||||
set @old_log_state = @@global.general_log;
|
|
||||||
set global general_log = 'OFF';
|
set global general_log = 'OFF';
|
||||||
alter table mysql.general_log engine = CSV;
|
alter table mysql.general_log engine = CSV;
|
||||||
set global general_log = @old_log_state;
|
set global general_log = old_log_state;
|
||||||
set v1 = v1 + 1;
|
set v1 = v1 + 1;
|
||||||
end while;
|
end while;
|
||||||
end//
|
end//
|
||||||
@ -713,9 +681,9 @@ drop procedure proc25422_alter_general;
|
|||||||
--enable_ps_protocol
|
--enable_ps_protocol
|
||||||
|
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug#23044 (Warnings on flush of a log table)
|
--echo # Bug#23044 (Warnings on flush of a log table)
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
FLUSH TABLE mysql.general_log;
|
FLUSH TABLE mysql.general_log;
|
||||||
show warnings;
|
show warnings;
|
||||||
@ -723,18 +691,10 @@ show warnings;
|
|||||||
FLUSH TABLE mysql.slow_log;
|
FLUSH TABLE mysql.slow_log;
|
||||||
show warnings;
|
show warnings;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug#17876 (Truncating mysql.slow_log in a SP after using cursor locks the
|
--echo # Bug#17876 (Truncating mysql.slow_log in a SP after using cursor locks the
|
||||||
# thread)
|
--echo # thread)
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
--disable_warnings
|
|
||||||
DROP TABLE IF EXISTS `db_17876.slow_log_data`;
|
|
||||||
DROP TABLE IF EXISTS `db_17876.general_log_data`;
|
|
||||||
DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
|
|
||||||
DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
|
|
||||||
DROP DATABASE IF EXISTS `db_17876`;
|
|
||||||
--enable_warnings
|
|
||||||
|
|
||||||
CREATE DATABASE db_17876;
|
CREATE DATABASE db_17876;
|
||||||
|
|
||||||
@ -872,9 +832,9 @@ DROP DATABASE IF EXISTS `db_17876`;
|
|||||||
SET GLOBAL general_log = @old_general_log;
|
SET GLOBAL general_log = @old_general_log;
|
||||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug#21557 entries in the general query log truncated at 1000 characters.
|
--echo # Bug#21557 entries in the general query log truncated at 1000 characters.
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
select CONNECTION_ID() into @thread_id;
|
select CONNECTION_ID() into @thread_id;
|
||||||
--disable_ps_protocol
|
--disable_ps_protocol
|
||||||
@ -992,15 +952,9 @@ select command_type, argument from mysql.general_log where thread_id = @thread_i
|
|||||||
deallocate prepare long_query;
|
deallocate prepare long_query;
|
||||||
set global general_log = @old_general_log;
|
set global general_log = @old_general_log;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug#34306: Can't make copy of log tables when server binary log is enabled
|
--echo # Bug#34306: Can't make copy of log tables when server binary log is enabled
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
--disable_warnings
|
|
||||||
DROP TABLE IF EXISTS log_count;
|
|
||||||
DROP TABLE IF EXISTS slow_log_copy;
|
|
||||||
DROP TABLE IF EXISTS general_log_copy;
|
|
||||||
--enable_warnings
|
|
||||||
|
|
||||||
CREATE TABLE log_count (count BIGINT(21));
|
CREATE TABLE log_count (count BIGINT(21));
|
||||||
|
|
||||||
@ -1030,14 +984,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 = @saved_general_log;
|
SET GLOBAL general_log = @old_general_log;
|
||||||
SET GLOBAL slow_query_log = @saved_slow_query_log;
|
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||||
|
|
||||||
DROP TABLE log_count;
|
DROP TABLE log_count;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug #31700: thd->examined_row_count not incremented for 'const' type queries
|
--echo # Bug #31700: thd->examined_row_count not incremented for 'const' type queries
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
SET SESSION long_query_time = 0;
|
SET SESSION long_query_time = 0;
|
||||||
SET GLOBAL slow_query_log = ON;
|
SET GLOBAL slow_query_log = ON;
|
||||||
@ -1064,16 +1018,12 @@ DROP TABLE t1;
|
|||||||
|
|
||||||
TRUNCATE TABLE mysql.slow_log;
|
TRUNCATE TABLE mysql.slow_log;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Bug #47924 main.log_tables times out sporadically
|
--echo # Bug #47924 main.log_tables times out sporadically
|
||||||
#
|
--echo #
|
||||||
|
|
||||||
use mysql;
|
use mysql;
|
||||||
# Should result in error
|
# Should result in error
|
||||||
--disable_warnings
|
|
||||||
drop table if exists renamed_general_log;
|
|
||||||
drop table if exists renamed_slow_log;
|
|
||||||
--enable_warnings
|
|
||||||
--error ER_CANT_RENAME_LOG_TABLE
|
--error ER_CANT_RENAME_LOG_TABLE
|
||||||
RENAME TABLE general_log TO renamed_general_log;
|
RENAME TABLE general_log TO renamed_general_log;
|
||||||
--error ER_CANT_RENAME_LOG_TABLE
|
--error ER_CANT_RENAME_LOG_TABLE
|
||||||
@ -1083,7 +1033,6 @@ use test;
|
|||||||
flush tables with read lock;
|
flush tables with read lock;
|
||||||
unlock tables;
|
unlock tables;
|
||||||
|
|
||||||
SET @@session.long_query_time= @old_long_query_time;
|
|
||||||
|
|
||||||
SET @@global.log_output= @old_log_output;
|
SET @@global.log_output= @old_log_output;
|
||||||
SET @@global.slow_query_log= @old_slow_query_log;
|
SET @@global.slow_query_log= @old_slow_query_log;
|
||||||
|
Reference in New Issue
Block a user