Commit de8be58b authored by Sergey Petrunya's avatar Sergey Petrunya

Automatic merge

parents a7a1b822 1a15aaa9
...@@ -17,7 +17,7 @@ event_time user_host thread_id server_id command_type argument ...@@ -17,7 +17,7 @@ event_time user_host thread_id server_id command_type argument
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log
truncate table slow_log; truncate table slow_log;
select * from slow_log; select * from slow_log;
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id
truncate table general_log; truncate table general_log;
select * from general_log where argument like '%general_log%'; select * from general_log where argument like '%general_log%';
event_time user_host thread_id server_id command_type argument event_time user_host thread_id server_id command_type argument
...@@ -53,18 +53,18 @@ ERROR HY000: You can't use locks with log tables. ...@@ -53,18 +53,18 @@ ERROR HY000: You can't use locks with log tables.
show create table mysql.general_log; show create table mysql.general_log;
Table Create Table Table Create Table
general_log CREATE TABLE `general_log` ( general_log CREATE TABLE `general_log` (
`event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext NOT NULL, `user_host` mediumtext NOT NULL,
`thread_id` int(11) NOT NULL, `thread_id` bigint(21) unsigned NOT NULL,
`server_id` int(10) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL,
`command_type` varchar(64) NOT NULL, `command_type` varchar(64) NOT NULL,
`argument` mediumtext NOT NULL `argument` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log' ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
show fields from mysql.general_log; show fields from mysql.general_log;
Field Type Null Key Default Extra Field Type Null Key Default Extra
event_time timestamp(6) NO CURRENT_TIMESTAMP(6) on update CURRENT_TIMESTAMP event_time timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
user_host mediumtext NO NULL user_host mediumtext NO NULL
thread_id int(11) NO NULL thread_id bigint(21) unsigned NO NULL
server_id int(10) unsigned NO NULL server_id int(10) unsigned NO NULL
command_type varchar(64) NO NULL command_type varchar(64) NO NULL
argument mediumtext NO NULL argument mediumtext NO NULL
...@@ -81,7 +81,8 @@ slow_log CREATE TABLE `slow_log` ( ...@@ -81,7 +81,8 @@ slow_log CREATE TABLE `slow_log` (
`last_insert_id` int(11) NOT NULL, `last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL, `insert_id` int(11) NOT NULL,
`server_id` int(10) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL `sql_text` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
show fields from mysql.slow_log; show fields from mysql.slow_log;
Field Type Null Key Default Extra Field Type Null Key Default Extra
...@@ -96,6 +97,7 @@ last_insert_id int(11) NO NULL ...@@ -96,6 +97,7 @@ last_insert_id int(11) NO NULL
insert_id int(11) NO NULL insert_id int(11) NO NULL
server_id int(10) unsigned NO NULL server_id int(10) unsigned NO NULL
sql_text mediumtext NO NULL sql_text mediumtext NO NULL
thread_id bigint(21) unsigned NO NULL
flush logs; flush logs;
flush tables; flush tables;
SET GLOBAL GENERAL_LOG=ON; SET GLOBAL GENERAL_LOG=ON;
...@@ -146,8 +148,8 @@ select sleep(2); ...@@ -146,8 +148,8 @@ select sleep(2);
sleep(2) sleep(2)
0 0
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 start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id
TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 mysql 0 0 1 select sleep(2) TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 mysql 0 0 1 select sleep(2) THREAD_ID
set @@session.long_query_time = @saved_long_query_time; set @@session.long_query_time = @saved_long_query_time;
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
...@@ -164,9 +166,9 @@ set global slow_query_log='OFF'; ...@@ -164,9 +166,9 @@ set global slow_query_log='OFF';
show create table mysql.general_log; show create table mysql.general_log;
Table Create Table Table Create Table
general_log CREATE TABLE `general_log` ( general_log CREATE TABLE `general_log` (
`event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext NOT NULL, `user_host` mediumtext NOT NULL,
`thread_id` int(11) NOT NULL, `thread_id` bigint(21) unsigned NOT NULL,
`server_id` int(10) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL,
`command_type` varchar(64) NOT NULL, `command_type` varchar(64) NOT NULL,
`argument` mediumtext NOT NULL `argument` mediumtext NOT NULL
...@@ -184,16 +186,17 @@ slow_log CREATE TABLE `slow_log` ( ...@@ -184,16 +186,17 @@ slow_log CREATE TABLE `slow_log` (
`last_insert_id` int(11) NOT NULL, `last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL, `insert_id` int(11) NOT NULL,
`server_id` int(10) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL `sql_text` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
alter table mysql.general_log engine=myisam; alter table mysql.general_log engine=myisam;
alter table mysql.slow_log engine=myisam; alter table mysql.slow_log engine=myisam;
show create table mysql.general_log; show create table mysql.general_log;
Table Create Table Table Create Table
general_log CREATE TABLE `general_log` ( general_log CREATE TABLE `general_log` (
`event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext NOT NULL, `user_host` mediumtext NOT NULL,
`thread_id` int(11) NOT NULL, `thread_id` bigint(21) unsigned NOT NULL,
`server_id` int(10) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL,
`command_type` varchar(64) NOT NULL, `command_type` varchar(64) NOT NULL,
`argument` mediumtext NOT NULL `argument` mediumtext NOT NULL
...@@ -211,7 +214,8 @@ slow_log CREATE TABLE `slow_log` ( ...@@ -211,7 +214,8 @@ slow_log CREATE TABLE `slow_log` (
`last_insert_id` int(11) NOT NULL, `last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL, `insert_id` int(11) NOT NULL,
`server_id` int(10) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL `sql_text` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Slow log' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Slow log'
set global general_log='ON'; set global general_log='ON';
set global slow_query_log='ON'; set global slow_query_log='ON';
...@@ -256,15 +260,15 @@ set storage_engine= @save_storage_engine; ...@@ -256,15 +260,15 @@ set storage_engine= @save_storage_engine;
drop table mysql.slow_log; drop table mysql.slow_log;
drop table mysql.general_log; drop table mysql.general_log;
drop table mysql.general_log; drop table mysql.general_log;
ERROR 42S02: Unknown table 'general_log' ERROR 42S02: Unknown table 'mysql.general_log'
drop table mysql.slow_log; drop table mysql.slow_log;
ERROR 42S02: Unknown table 'slow_log' ERROR 42S02: Unknown table 'mysql.slow_log'
use mysql; use mysql;
CREATE TABLE `general_log` ( CREATE TABLE `general_log` (
`event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP `event_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP, ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext NOT NULL, `user_host` mediumtext NOT NULL,
`thread_id` int(11) NOT NULL, `thread_id` BIGINT(21) UNSIGNED NOT NULL,
`server_id` int(10) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL,
`command_type` varchar(64) NOT NULL, `command_type` varchar(64) NOT NULL,
`argument` mediumtext NOT NULL `argument` mediumtext NOT NULL
...@@ -281,7 +285,8 @@ ON UPDATE CURRENT_TIMESTAMP, ...@@ -281,7 +285,8 @@ ON UPDATE CURRENT_TIMESTAMP,
`last_insert_id` int(11) NOT NULL, `last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL, `insert_id` int(11) NOT NULL,
`server_id` int(10) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL `sql_text` mediumtext NOT NULL,
`thread_id` BIGINT(21) UNSIGNED NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'; ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
set global general_log='ON'; set global general_log='ON';
set global slow_query_log='ON'; set global slow_query_log='ON';
...@@ -308,7 +313,7 @@ event_time user_host thread_id server_id command_type argument ...@@ -308,7 +313,7 @@ event_time user_host thread_id server_id command_type argument
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log
truncate table slow_log; truncate table slow_log;
select * from slow_log; select * from slow_log;
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id
create table general_log_new like general_log; create table general_log_new like general_log;
rename table general_log TO renamed_general_log, general_log_new TO general_log; rename table general_log TO renamed_general_log, general_log_new TO general_log;
create table slow_log_new like slow_log; create table slow_log_new like slow_log;
...@@ -329,9 +334,9 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query select * from slow_log ...@@ -329,9 +334,9 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query select * from slow_log
TIMESTAMP USER_HOST THREAD_ID 1 Query create table general_log_new like general_log TIMESTAMP USER_HOST THREAD_ID 1 Query create table general_log_new like general_log
TIMESTAMP USER_HOST THREAD_ID 1 Query rename table general_log TO renamed_general_log, general_log_new TO general_log TIMESTAMP USER_HOST THREAD_ID 1 Query rename table general_log TO renamed_general_log, general_log_new TO general_log
select * from slow_log; select * from slow_log;
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id
select * from renamed_slow_log; select * from renamed_slow_log;
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id
set global general_log='OFF'; set global general_log='OFF';
RENAME TABLE general_log TO general_log2; RENAME TABLE general_log TO general_log2;
set global slow_query_log='OFF'; set global slow_query_log='OFF';
...@@ -362,8 +367,6 @@ show tables like "%log%"; ...@@ -362,8 +367,6 @@ show tables like "%log%";
Tables_in_mysql (%log%) Tables_in_mysql (%log%)
general_log general_log
general_log_new general_log_new
ndb_binlog_index
slave_relay_log_info
slow_log slow_log
slow_log_new slow_log_new
drop table slow_log_new, general_log_new; drop table slow_log_new, general_log_new;
...@@ -426,10 +429,10 @@ SELECT "My own slow query", sleep(2); ...@@ -426,10 +429,10 @@ SELECT "My own slow query", sleep(2);
My own slow query sleep(2) My own slow query sleep(2)
My own slow query 0 My own slow query 0
SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3; SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3;
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text seq start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id seq
START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 2 START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 2 2
START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 2 3
START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 4 START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 2 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 =@saved_long_query_time;
FLUSH LOGS; FLUSH LOGS;
...@@ -548,6 +551,7 @@ BEGIN ...@@ -548,6 +551,7 @@ BEGIN
DECLARE start_time, query_time, lock_time CHAR(28); DECLARE start_time, query_time, lock_time CHAR(28);
DECLARE user_host MEDIUMTEXT; DECLARE user_host MEDIUMTEXT;
DECLARE rows_set, rows_examined, last_insert_id, insert_id, server_id INT; DECLARE rows_set, rows_examined, last_insert_id, insert_id, server_id INT;
DECLARE thread_id BIGINT UNSIGNED;
DECLARE dbname MEDIUMTEXT; DECLARE dbname MEDIUMTEXT;
DECLARE sql_text BLOB; DECLARE sql_text BLOB;
DECLARE done INT DEFAULT 0; DECLARE done INT DEFAULT 0;
...@@ -561,14 +565,14 @@ DECLARE CONTINUE HANDLER FOR ER_SP_FETCH_NO_DATA SET done = 1; ...@@ -561,14 +565,14 @@ DECLARE CONTINUE HANDLER FOR ER_SP_FETCH_NO_DATA SET done = 1;
FETCH cur1 INTO FETCH cur1 INTO
start_time, user_host, query_time, lock_time, start_time, user_host, query_time, lock_time,
rows_set, rows_examined, dbname, last_insert_id, rows_set, rows_examined, dbname, last_insert_id,
insert_id, server_id, sql_text; insert_id, server_id, sql_text, thread_id;
END; END;
IF NOT done THEN IF NOT done THEN
BEGIN BEGIN
INSERT INTO INSERT INTO
`db_17876.slow_log_data` `db_17876.slow_log_data`
VALUES(start_time, user_host, query_time, lock_time, rows_set, rows_examined, VALUES(start_time, user_host, query_time, lock_time, rows_set, rows_examined,
dbname, last_insert_id, insert_id, server_id, sql_text); dbname, last_insert_id, insert_id, server_id, sql_text, thread_id);
END; END;
END IF; END IF;
END; END;
......
...@@ -180,7 +180,7 @@ drop table bug16905; ...@@ -180,7 +180,7 @@ drop table bug16905;
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 --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 = @saved_long_query_time;
...@@ -290,10 +290,10 @@ drop table mysql.slow_log; ...@@ -290,10 +290,10 @@ drop table mysql.slow_log;
use mysql; use mysql;
CREATE TABLE `general_log` ( CREATE TABLE `general_log` (
`event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP `event_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP, ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext NOT NULL, `user_host` mediumtext NOT NULL,
`thread_id` int(11) NOT NULL, `thread_id` BIGINT(21) UNSIGNED NOT NULL,
`server_id` int(10) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL,
`command_type` varchar(64) NOT NULL, `command_type` varchar(64) NOT NULL,
`argument` mediumtext NOT NULL `argument` mediumtext NOT NULL
...@@ -311,7 +311,8 @@ CREATE TABLE `slow_log` ( ...@@ -311,7 +311,8 @@ CREATE TABLE `slow_log` (
`last_insert_id` int(11) NOT NULL, `last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL, `insert_id` int(11) NOT NULL,
`server_id` int(10) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL `sql_text` mediumtext NOT NULL,
`thread_id` BIGINT(21) UNSIGNED NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'; ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
set global general_log='ON'; set global general_log='ON';
...@@ -746,6 +747,7 @@ BEGIN ...@@ -746,6 +747,7 @@ BEGIN
DECLARE start_time, query_time, lock_time CHAR(28); DECLARE start_time, query_time, lock_time CHAR(28);
DECLARE user_host MEDIUMTEXT; DECLARE user_host MEDIUMTEXT;
DECLARE rows_set, rows_examined, last_insert_id, insert_id, server_id INT; DECLARE rows_set, rows_examined, last_insert_id, insert_id, server_id INT;
DECLARE thread_id BIGINT UNSIGNED;
DECLARE dbname MEDIUMTEXT; DECLARE dbname MEDIUMTEXT;
DECLARE sql_text BLOB; DECLARE sql_text BLOB;
DECLARE done INT DEFAULT 0; DECLARE done INT DEFAULT 0;
...@@ -763,7 +765,7 @@ BEGIN ...@@ -763,7 +765,7 @@ BEGIN
FETCH cur1 INTO FETCH cur1 INTO
start_time, user_host, query_time, lock_time, start_time, user_host, query_time, lock_time,
rows_set, rows_examined, dbname, last_insert_id, rows_set, rows_examined, dbname, last_insert_id,
insert_id, server_id, sql_text; insert_id, server_id, sql_text, thread_id;
END; END;
IF NOT done THEN IF NOT done THEN
...@@ -771,7 +773,7 @@ BEGIN ...@@ -771,7 +773,7 @@ BEGIN
INSERT INTO INSERT INTO
`db_17876.slow_log_data` `db_17876.slow_log_data`
VALUES(start_time, user_host, query_time, lock_time, rows_set, rows_examined, VALUES(start_time, user_host, query_time, lock_time, rows_set, rows_examined,
dbname, last_insert_id, insert_id, server_id, sql_text); dbname, last_insert_id, insert_id, server_id, sql_text, thread_id);
END; END;
END IF; END IF;
END; END;
......
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