List:Commits« Previous MessageNext Message »
From:Tatiana Azundris Nurnberg Date:February 10 2011 11:49am
Subject:bzr commit into mysql-trunk branch (azundris:3638)
View as plain text  
#At file:///Users/tnurnberg/forest/my-trunk/ based on revid:mattias.jonsson@stripped

 3638 Tatiana Azundris Nurnberg	2011-02-10 [merge]
      manual merge

    added:
      mysql-test/suite/sys_vars/r/core_file_basic.result
      mysql-test/suite/sys_vars/t/core_file_basic-master.opt
      mysql-test/suite/sys_vars/t/core_file_basic.test
    modified:
      mysql-test/r/log_state.result
      mysql-test/r/log_tables.result
      mysql-test/r/system_mysql_db.result
      mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result
      mysql-test/suite/sys_vars/r/slow_query_log_func.result
      mysql-test/suite/sys_vars/t/slow_query_log_func.test
      mysql-test/t/log_state.test
      mysql-test/t/log_tables.test
      scripts/mysql_system_tables.sql
      scripts/mysql_system_tables_fix.sql
      scripts/mysqldumpslow.sh
      sql/log.cc
      sql/log.h
      sql/mysqld.cc
      sql/sys_vars.cc
      sql/sys_vars.h
=== modified file 'mysql-test/r/log_state.result'
--- a/mysql-test/r/log_state.result	2010-11-02 11:53:54 +0000
+++ b/mysql-test/r/log_state.result	2011-02-10 11:13:41 +0000
@@ -41,7 +41,7 @@ select sleep(@long_query_time + 1);
 sleep(@long_query_time + 1)
 0
 select * from mysql.slow_log where sql_text NOT LIKE '%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
 # Switch to connection default
 set global slow_query_log= ON;
 # Switch to connection con1
@@ -50,8 +50,8 @@ select sleep(@long_query_time + 1);
 sleep(@long_query_time + 1)
 0
 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
-start_time	user_host	query_time	lock_time	rows_sent	rows_examined	db	last_insert_id	insert_id	server_id	sql_text
-TIMESTAMP	USER_HOST	QUERY_TIME	00:00:00	1	0	test	0	0	1	select sleep(@long_query_time + 1)
+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	1	0	test	0	0	1	QUERY	THREAD_ID
 # Switch to connection default
 show global variables
 where Variable_name = 'log' or Variable_name = 'log_slow_queries' or

=== modified file 'mysql-test/r/log_tables.result'
--- a/mysql-test/r/log_tables.result	2010-11-15 16:43:41 +0000
+++ b/mysql-test/r/log_tables.result	2011-02-10 11:13:41 +0000
@@ -17,7 +17,7 @@ event_time	user_host	thread_id	server_id
 TIMESTAMP	USER_HOST	THREAD_ID	1	Query	select * from general_log
 truncate table 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;
 select * from general_log where argument like '%general_log%';
 event_time	user_host	thread_id	server_id	command_type	argument
@@ -81,7 +81,8 @@ slow_log	CREATE TABLE `slow_log` (
   `last_insert_id` int(11) NOT NULL,
   `insert_id` int(11) NOT NULL,
   `server_id` int(10) unsigned NOT NULL,
-  `sql_text` mediumtext NOT NULL
+  `sql_text` mediumtext NOT NULL,
+  `thread_id` int(11) NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
 show fields from mysql.slow_log;
 Field	Type	Null	Key	Default	Extra
@@ -96,6 +97,7 @@ last_insert_id	int(11)	NO		NULL	
 insert_id	int(11)	NO		NULL	
 server_id	int(10) unsigned	NO		NULL	
 sql_text	mediumtext	NO		NULL	
+thread_id	int(11)	NO		NULL	
 flush logs;
 flush tables;
 SET GLOBAL GENERAL_LOG=ON;
@@ -146,8 +148,8 @@ select sleep(2);
 sleep(2)
 0
 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
-TIMESTAMP	USER_HOST	QUERY_TIME	00:00:00	1	0	mysql	0	0	1	select sleep(2)
+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	1	0	mysql	0	0	1	QUERY	THREAD_ID
 set @@session.long_query_time = @saved_long_query_time;
 alter table mysql.general_log engine=myisam;
 ERROR HY000: You cannot 'ALTER' a log table if logging is enabled
@@ -184,7 +186,8 @@ slow_log	CREATE TABLE `slow_log` (
   `last_insert_id` int(11) NOT NULL,
   `insert_id` int(11) NOT NULL,
   `server_id` int(10) unsigned NOT NULL,
-  `sql_text` mediumtext NOT NULL
+  `sql_text` mediumtext NOT NULL,
+  `thread_id` int(11) NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
 alter table mysql.general_log engine=myisam;
 alter table mysql.slow_log engine=myisam;
@@ -211,7 +214,8 @@ slow_log	CREATE TABLE `slow_log` (
   `last_insert_id` int(11) NOT NULL,
   `insert_id` int(11) NOT NULL,
   `server_id` int(10) unsigned NOT NULL,
-  `sql_text` mediumtext NOT NULL
+  `sql_text` mediumtext NOT NULL,
+  `thread_id` int(11) NOT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Slow log'
 set global general_log='ON';
 set global slow_query_log='ON';
@@ -281,7 +285,8 @@ ON UPDATE CURRENT_TIMESTAMP,
 `last_insert_id` int(11) NOT NULL,
 `insert_id` int(11) NOT NULL,
 `server_id` int(10) unsigned NOT NULL,
-`sql_text` mediumtext NOT NULL
+`sql_text` mediumtext NOT NULL,
+`thread_id` int(11) NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
 set global general_log='ON';
 set global slow_query_log='ON';
@@ -308,7 +313,7 @@ event_time	user_host	thread_id	server_id
 TIMESTAMP	USER_HOST	THREAD_ID	1	Query	select * from general_log
 truncate table 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;
 rename table general_log TO renamed_general_log, general_log_new TO general_log;
 create table slow_log_new like slow_log;
@@ -329,9 +334,9 @@ TIMESTAMP	USER_HOST	THREAD_ID	1	Query	se
 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
 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;
-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';
 RENAME TABLE general_log TO general_log2;
 set global slow_query_log='OFF';
@@ -368,75 +373,6 @@ slow_log
 slow_log_new
 drop table slow_log_new, general_log_new;
 use test;
-SET GLOBAL LOG_OUTPUT = 'TABLE';
-SET GLOBAL general_log = 0;
-FLUSH LOGS;
-TRUNCATE TABLE mysql.general_log;
-ALTER TABLE mysql.general_log ENGINE = MyISAM;
-ALTER TABLE mysql.general_log
-ADD COLUMN seq BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY;
-SET GLOBAL general_log = 1;
-FLUSH LOGS;
-SELECT * FROM mysql.general_log;
-event_time	user_host	thread_id	server_id	command_type	argument	seq
-EVENT_TIME	USER_HOST	THREAD_ID	SERVER_ID	Query	FLUSH LOGS	1
-EVENT_TIME	USER_HOST	THREAD_ID	SERVER_ID	Query	SELECT * FROM mysql.general_log	2
-SELECT * FROM mysql.general_log;
-event_time	user_host	thread_id	server_id	command_type	argument	seq
-EVENT_TIME	USER_HOST	THREAD_ID	SERVER_ID	Query	FLUSH LOGS	1
-EVENT_TIME	USER_HOST	THREAD_ID	SERVER_ID	Query	SELECT * FROM mysql.general_log	2
-EVENT_TIME	USER_HOST	THREAD_ID	SERVER_ID	Query	SELECT * FROM mysql.general_log	3
-SELECT "My own query 1";
-My own query 1
-My own query 1
-SELECT "My own query 2";
-My own query 2
-My own query 2
-SELECT * FROM mysql.general_log;
-event_time	user_host	thread_id	server_id	command_type	argument	seq
-EVENT_TIME	USER_HOST	THREAD_ID	SERVER_ID	Query	FLUSH LOGS	1
-EVENT_TIME	USER_HOST	THREAD_ID	SERVER_ID	Query	SELECT * FROM mysql.general_log	2
-EVENT_TIME	USER_HOST	THREAD_ID	SERVER_ID	Query	SELECT * FROM mysql.general_log	3
-EVENT_TIME	USER_HOST	THREAD_ID	SERVER_ID	Query	SELECT "My own query 1"	4
-EVENT_TIME	USER_HOST	THREAD_ID	SERVER_ID	Query	SELECT "My own query 2"	5
-EVENT_TIME	USER_HOST	THREAD_ID	SERVER_ID	Query	SELECT * FROM mysql.general_log	6
-SET GLOBAL general_log = 0;
-FLUSH LOGS;
-ALTER TABLE mysql.general_log DROP COLUMN seq;
-ALTER TABLE mysql.general_log ENGINE = CSV;
-SET GLOBAL slow_query_log = 0;
-FLUSH LOGS;
-TRUNCATE TABLE mysql.slow_log;
-ALTER TABLE mysql.slow_log ENGINE = MyISAM;
-ALTER TABLE mysql.slow_log
-ADD COLUMN seq BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY;
-SET SESSION long_query_time = 1;
-SET GLOBAL slow_query_log = 1;
-FLUSH LOGS;
-SELECT "My own slow query", sleep(2);
-My own slow query	sleep(2)
-My own slow query	0
-SELECT "My own slow query", sleep(2);
-My own slow query	sleep(2)
-My own slow query	0
-SELECT "My own slow query", sleep(2);
-My own slow query	sleep(2)
-My own slow query	0
-SELECT "My own slow query", sleep(2);
-My own slow query	sleep(2)
-My own slow query	0
-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	00:00:00	1	0	test	0	0	1	SELECT "My own slow query", sleep(2)	2
-START_TIME	USER_HOST	QUERY_TIME	00:00:00	1	0	test	0	0	1	SELECT "My own slow query", sleep(2)	3
-START_TIME	USER_HOST	QUERY_TIME	00:00:00	1	0	test	0	0	1	SELECT "My own slow query", sleep(2)	4
-SET GLOBAL slow_query_log = 0;
-SET SESSION long_query_time =@saved_long_query_time;
-FLUSH LOGS;
-ALTER TABLE mysql.slow_log DROP COLUMN seq;
-ALTER TABLE mysql.slow_log ENGINE = CSV;
-SET GLOBAL general_log = @old_general_log;
-SET GLOBAL slow_query_log = @old_slow_query_log;
 drop procedure if exists proc25422_truncate_slow;
 drop procedure if exists proc25422_truncate_general;
 drop procedure if exists proc25422_alter_slow;
@@ -547,7 +483,7 @@ CREATE procedure `db_17876.archiveSlowLo
 BEGIN
 DECLARE start_time, query_time, lock_time CHAR(20);
 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, thread_id INT;
 DECLARE dbname MEDIUMTEXT;
 DECLARE sql_text BLOB;
 DECLARE done INT DEFAULT 0;
@@ -561,14 +497,14 @@ DECLARE CONTINUE HANDLER FOR ER_SP_FETCH
 FETCH cur1 INTO
 start_time, user_host, query_time, lock_time,
 rows_set, rows_examined, dbname, last_insert_id,
-insert_id, server_id, sql_text;
+insert_id, server_id, sql_text, thread_id;
 END;
 IF NOT done THEN
 BEGIN
 INSERT INTO
 `db_17876.slow_log_data`
             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 IF;
 END;

=== modified file 'mysql-test/r/system_mysql_db.result'
--- a/mysql-test/r/system_mysql_db.result	2010-12-17 11:28:59 +0000
+++ b/mysql-test/r/system_mysql_db.result	2011-02-10 11:13:41 +0000
@@ -264,7 +264,8 @@ slow_log	CREATE TABLE `slow_log` (
   `last_insert_id` int(11) NOT NULL,
   `insert_id` int(11) NOT NULL,
   `server_id` int(10) unsigned NOT NULL,
-  `sql_text` mediumtext NOT NULL
+  `sql_text` mediumtext NOT NULL,
+  `thread_id` int(11) NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
 show tables;
 Tables_in_test

=== modified file 'mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result	2010-12-09 16:17:13 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result	2011-02-10 11:48:58 +0000
@@ -31,7 +31,7 @@ ERROR 1050 (42S01) at line 341: Table 't
 ERROR 1050 (42S01) at line 385: Table 'table_io_waits_summary_by_table' already exists
 ERROR 1050 (42S01) at line 464: Table 'table_lock_waits_summary_by_table' already exists
 ERROR 1050 (42S01) at line 484: Table 'threads' already exists
-ERROR 1644 (HY000) at line 902: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 904: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_table";
 Tables_in_performance_schema (user_table)
@@ -67,7 +67,7 @@ ERROR 1050 (42S01) at line 341: Table 't
 ERROR 1050 (42S01) at line 385: Table 'table_io_waits_summary_by_table' already exists
 ERROR 1050 (42S01) at line 464: Table 'table_lock_waits_summary_by_table' already exists
 ERROR 1050 (42S01) at line 484: Table 'threads' already exists
-ERROR 1644 (HY000) at line 902: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 904: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_view";
 Tables_in_performance_schema (user_view)
@@ -101,7 +101,7 @@ ERROR 1050 (42S01) at line 341: Table 't
 ERROR 1050 (42S01) at line 385: Table 'table_io_waits_summary_by_table' already exists
 ERROR 1050 (42S01) at line 464: Table 'table_lock_waits_summary_by_table' already exists
 ERROR 1050 (42S01) at line 484: Table 'threads' already exists
-ERROR 1644 (HY000) at line 902: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 904: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -135,7 +135,7 @@ ERROR 1050 (42S01) at line 341: Table 't
 ERROR 1050 (42S01) at line 385: Table 'table_io_waits_summary_by_table' already exists
 ERROR 1050 (42S01) at line 464: Table 'table_lock_waits_summary_by_table' already exists
 ERROR 1050 (42S01) at line 484: Table 'threads' already exists
-ERROR 1644 (HY000) at line 902: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 904: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -169,7 +169,7 @@ ERROR 1050 (42S01) at line 341: Table 't
 ERROR 1050 (42S01) at line 385: Table 'table_io_waits_summary_by_table' already exists
 ERROR 1050 (42S01) at line 464: Table 'table_lock_waits_summary_by_table' already exists
 ERROR 1050 (42S01) at line 484: Table 'threads' already exists
-ERROR 1644 (HY000) at line 902: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 904: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.event where db='performance_schema';
 name

=== added file 'mysql-test/suite/sys_vars/r/core_file_basic.result'
--- a/mysql-test/suite/sys_vars/r/core_file_basic.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/core_file_basic.result	2011-02-10 04:52:55 +0000
@@ -0,0 +1,6 @@
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE '%core%';
+VARIABLE_NAME	VARIABLE_VALUE
+CORE_FILE	ON
+SHOW GLOBAL VARIABLES LIKE '%core%';
+Variable_name	Value
+core_file	ON

=== modified file 'mysql-test/suite/sys_vars/r/slow_query_log_func.result'
--- a/mysql-test/suite/sys_vars/r/slow_query_log_func.result	2010-08-30 06:38:09 +0000
+++ b/mysql-test/suite/sys_vars/r/slow_query_log_func.result	2011-01-06 13:21:47 +0000
@@ -14,12 +14,17 @@ count(*)
 '----When slow_query_log = ON-----'
 SET @@global.slow_query_log = ON;
 TRUNCATE mysql.slow_log;
-SELECT sleep(2);
-sleep(2)
+SELECT sleep(2) AS bug53630;
+bug53630
 0
-SELECT count(*) > 0 FROM mysql.slow_log;
+SELECT count(*) > 0 FROM mysql.slow_log WHERE sql_text LIKE '% bug53630';
 count(*) > 0
 1
+SELECT thread_id - connection_id() FROM mysql.slow_log
+WHERE sql_text LIKE '% bug53630'
+                                   ORDER BY start_time DESC LIMIT 1;
+thread_id - connection_id()
+0
 'Bug#47905 stored procedures not logged correctly to slow query log'
 TRUNCATE mysql.slow_log;
 CREATE PROCEDURE p_test() 

=== added file 'mysql-test/suite/sys_vars/t/core_file_basic-master.opt'
--- a/mysql-test/suite/sys_vars/t/core_file_basic-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/core_file_basic-master.opt	2011-02-10 04:52:55 +0000
@@ -0,0 +1,2 @@
+--core-file
+

=== added file 'mysql-test/suite/sys_vars/t/core_file_basic.test'
--- a/mysql-test/suite/sys_vars/t/core_file_basic.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/core_file_basic.test	2011-02-10 04:52:55 +0000
@@ -0,0 +1,2 @@
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE '%core%';
+SHOW GLOBAL VARIABLES LIKE '%core%';

=== modified file 'mysql-test/suite/sys_vars/t/slow_query_log_func.test'
--- a/mysql-test/suite/sys_vars/t/slow_query_log_func.test	2010-06-08 08:58:19 +0000
+++ b/mysql-test/suite/sys_vars/t/slow_query_log_func.test	2011-01-06 13:21:47 +0000
@@ -27,10 +27,12 @@ SELECT count(*) FROM mysql.slow_log;
 SET @@global.slow_query_log = ON;
 TRUNCATE mysql.slow_log;
 # The sleep is the slow query
-SELECT sleep(2);
-
-SELECT count(*) > 0 FROM mysql.slow_log;
+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'

=== modified file 'mysql-test/t/log_state.test'
--- a/mysql-test/t/log_state.test	2010-11-02 11:53:54 +0000
+++ b/mysql-test/t/log_state.test	2011-02-10 11:13:41 +0000
@@ -48,7 +48,7 @@ connection con1;
 set @long_query_time = 2;
 set session long_query_time = @long_query_time;
 select sleep(@long_query_time + 1);
---replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME 11 QUERY 12 THREAD_ID
 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
 --echo # Switch to connection default
 connection default;
@@ -58,7 +58,7 @@ set global slow_query_log= ON;
 connection con1;
 set session long_query_time = @long_query_time;
 select sleep(@long_query_time + 1);
---replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME 11 QUERY 12 THREAD_ID
 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
 --echo # Switch to connection default
 connection default;

=== modified file 'mysql-test/t/log_tables.test'
--- a/mysql-test/t/log_tables.test	2010-11-08 14:35:45 +0000
+++ b/mysql-test/t/log_tables.test	2011-02-10 11:13:41 +0000
@@ -180,7 +180,7 @@ drop table bug16905;
 truncate table mysql.slow_log;
 set session long_query_time=1;
 select sleep(2);
---replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME 11 QUERY 12 THREAD_ID
 select * from mysql.slow_log;
 set @@session.long_query_time = @saved_long_query_time;
 
@@ -311,7 +311,8 @@ CREATE TABLE `slow_log` (
   `last_insert_id` int(11) NOT NULL,
   `insert_id` int(11) NOT NULL,
   `server_id` int(10) unsigned NOT NULL,
-  `sql_text` mediumtext NOT NULL
+  `sql_text` mediumtext NOT NULL,
+  `thread_id` int(11) NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
 
 set global general_log='ON';
@@ -471,77 +472,6 @@ drop table slow_log_new, general_log_new
 use test;
 
 #
-# Bug#27857 (Log tables supplies the wrong value for generating
-#            AUTO_INCREMENT numbers)
-#
-
-SET GLOBAL LOG_OUTPUT = 'TABLE';
-
-## test the general log
-
-SET GLOBAL general_log = 0;
-FLUSH LOGS;
-
-TRUNCATE TABLE mysql.general_log;
-ALTER TABLE mysql.general_log ENGINE = MyISAM;
-ALTER TABLE mysql.general_log
-  ADD COLUMN seq BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY;
-
-SET GLOBAL general_log = 1;
-FLUSH LOGS;
-
---replace_column 1 EVENT_TIME 2 USER_HOST 3 THREAD_ID 4 SERVER_ID
-SELECT * FROM mysql.general_log;
---replace_column 1 EVENT_TIME 2 USER_HOST 3 THREAD_ID 4 SERVER_ID
-SELECT * FROM mysql.general_log;
-SELECT "My own query 1";
-SELECT "My own query 2";
---replace_column 1 EVENT_TIME 2 USER_HOST 3 THREAD_ID 4 SERVER_ID
-SELECT * FROM mysql.general_log;
-
-SET GLOBAL general_log = 0;
-FLUSH LOGS;
-
-ALTER TABLE mysql.general_log DROP COLUMN seq;
-ALTER TABLE mysql.general_log ENGINE = CSV;
-
-## test the slow query log
-
-SET GLOBAL slow_query_log = 0;
-FLUSH LOGS;
-
-TRUNCATE TABLE mysql.slow_log;
-ALTER TABLE mysql.slow_log ENGINE = MyISAM;
-
-ALTER TABLE mysql.slow_log
-  ADD COLUMN seq BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY;
-
-SET SESSION long_query_time = 1;
-SET GLOBAL slow_query_log = 1;
-FLUSH LOGS;
-
-## FLUSH LOGS above might be slow, so the following is
-## logged as either seq 1-4 or seq 2-5
-SELECT "My own slow query", sleep(2);
-SELECT "My own slow query", sleep(2);
-SELECT "My own slow query", sleep(2);
-SELECT "My own slow query", sleep(2);
-
-## So we look for seq 2-4
---replace_column 1 START_TIME 2 USER_HOST 3 QUERY_TIME
-SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3;
-
-SET GLOBAL slow_query_log = 0;
-SET SESSION long_query_time =@saved_long_query_time;
-FLUSH LOGS;
-
-ALTER TABLE mysql.slow_log DROP COLUMN seq;
-ALTER TABLE mysql.slow_log ENGINE = CSV;
-
-SET GLOBAL general_log = @old_general_log;
-SET GLOBAL slow_query_log = @old_slow_query_log;
-
-#
 # Bug#25422 (Hang with log tables)
 #
 
@@ -745,7 +675,7 @@ CREATE procedure `db_17876.archiveSlowLo
 BEGIN
   DECLARE start_time, query_time, lock_time CHAR(20);
   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, thread_id INT;
   DECLARE dbname MEDIUMTEXT;
   DECLARE sql_text BLOB;
   DECLARE done INT DEFAULT 0;
@@ -763,7 +693,7 @@ BEGIN
         FETCH cur1 INTO
            start_time, user_host, query_time, lock_time,
            rows_set, rows_examined, dbname, last_insert_id,
-           insert_id, server_id, sql_text;
+           insert_id, server_id, sql_text, thread_id;
       END;
 
       IF NOT done THEN
@@ -771,7 +701,7 @@ BEGIN
           INSERT INTO
             `db_17876.slow_log_data`
             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 IF;
     END;

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2011-01-03 13:39:18 +0000
+++ b/scripts/mysql_system_tables.sql	2011-02-10 11:48:58 +0000
@@ -89,7 +89,7 @@ DROP PREPARE stmt;
 
 -- Create slow_log if CSV is enabled.
 
-SET @str = IF (@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="Slow log"', 'SET @dummy = 0');
+SET @str = IF (@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, sql_text MEDIUMTEXT NOT NULL, thread_id INTEGER NOT NULL) engine=CSV CHARACTER SET utf8 comment="Slow log"', 'SET @dummy = 0');
 
 PREPARE stmt FROM @str;
 EXECUTE stmt;

=== modified file 'scripts/mysql_system_tables_fix.sql'
--- a/scripts/mysql_system_tables_fix.sql	2010-12-29 00:38:59 +0000
+++ b/scripts/mysql_system_tables_fix.sql	2011-02-09 08:12:43 +0000
@@ -255,6 +255,8 @@ ALTER TABLE slow_log
   MODIFY insert_id INTEGER NOT NULL,
   MODIFY server_id INTEGER UNSIGNED NOT NULL,
   MODIFY sql_text MEDIUMTEXT NOT NULL;
+ALTER TABLE slow_log
+  ADD COLUMN thread_id INTEGER NOT NULL AFTER sql_text;
 SET GLOBAL slow_query_log = @old_log_state;
 
 ALTER TABLE plugin

=== modified file 'scripts/mysqldumpslow.sh'
--- a/scripts/mysqldumpslow.sh	2010-12-28 23:47:05 +0000
+++ b/scripts/mysqldumpslow.sh	2011-02-09 08:12:43 +0000
@@ -99,7 +99,7 @@ while ( defined($_ = shift @pending) or 
     }
 
     s/^#? Time: \d{6}\s+\d+:\d+:\d+.*\n//;
-    my ($user,$host) = s/^#? User\@Host:\s+(\S+)\s+\@\s+(\S+).*\n// ? ($1,$2) : ('','');
+    my ($user,$host,$dummy,$thread_id) = s/^#? User\@Host:\s+(\S+)\s+\@\s+(\S+)\s+\S+(\s+Id:\s+(\d+))?.*\n// ? ($1,$2,$3,$4) : ('','','','','');
 
     s/^# Query_time: ([0-9.]+)\s+Lock_time: ([0-9.]+)\s+Rows_sent: ([0-9.]+).*\n//;
     my ($t, $l, $r) = ($1, $2, $3);

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2011-02-09 07:31:17 +0000
+++ b/sql/log.cc	2011-02-10 11:48:58 +0000
@@ -48,6 +48,142 @@
 #define MAX_LOG_BUFFER_SIZE 1024
 #define MAX_TIME_SIZE 32
 
+static
+const TABLE_FIELD_TYPE slow_query_log_table_fields[SQLT_FIELD_COUNT] =
+{
+  {
+    { C_STRING_WITH_LEN("start_time") },
+    { C_STRING_WITH_LEN("timestamp") },
+    { NULL, 0 }
+  },
+  {
+    { C_STRING_WITH_LEN("user_host") },
+    { C_STRING_WITH_LEN("mediumtext") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("query_time") },
+    { C_STRING_WITH_LEN("time") },
+    { NULL, 0 }
+  },
+  {
+    { C_STRING_WITH_LEN("lock_time") },
+    { C_STRING_WITH_LEN("time") },
+    { NULL, 0 }
+  },
+  {
+    { C_STRING_WITH_LEN("rows_sent") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0 }
+  },
+  {
+    { C_STRING_WITH_LEN("rows_examined") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0 }
+  },
+  {
+    { C_STRING_WITH_LEN("db") },
+    { C_STRING_WITH_LEN("varchar(512)") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("last_insert_id") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0 }
+  },
+  {
+    { C_STRING_WITH_LEN("insert_id") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0 }
+  },
+  {
+    { C_STRING_WITH_LEN("server_id") },
+    { C_STRING_WITH_LEN("int(10) unsigned") },
+    { NULL, 0 }
+  },
+  {
+    { C_STRING_WITH_LEN("sql_text") },
+    { C_STRING_WITH_LEN("mediumtext") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("thread_id") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0 }
+  }
+};
+
+static const TABLE_FIELD_DEF
+  slow_query_log_table_def= {SQLT_FIELD_COUNT, slow_query_log_table_fields};
+
+class Slow_query_log_table_intact : public Table_check_intact
+{
+protected:
+  void report_error(uint, const char *fmt, ...)
+  {
+    va_list args;
+    va_start(args, fmt);
+    error_log_print(ERROR_LEVEL, fmt, args);
+    va_end(args);
+  }
+};
+
+/** In case of an error, a message is printed to the error log. */
+static Slow_query_log_table_intact sqlt_intact;
+
+static
+const TABLE_FIELD_TYPE general_log_table_fields[GLT_FIELD_COUNT] =
+{
+  {
+    { C_STRING_WITH_LEN("event_time") },
+    { C_STRING_WITH_LEN("timestamp") },
+    { NULL, 0 }
+  },
+  {
+    { C_STRING_WITH_LEN("user_host") },
+    { C_STRING_WITH_LEN("mediumtext") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("thread_id") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0 }
+  },
+  {
+    { C_STRING_WITH_LEN("server_id") },
+    { C_STRING_WITH_LEN("int(10) unsigned") },
+    { NULL, 0 }
+  },
+  {
+    { C_STRING_WITH_LEN("command_type") },
+    { C_STRING_WITH_LEN("varchar(64)") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("argument") },
+    { C_STRING_WITH_LEN("mediumtext") },
+    { C_STRING_WITH_LEN("utf8") }
+  }
+};
+
+static const TABLE_FIELD_DEF
+  general_log_table_def= {GLT_FIELD_COUNT, general_log_table_fields};
+
+class General_log_table_intact : public Table_check_intact
+{
+protected:
+  void report_error(uint, const char *fmt, ...)
+  {
+    va_list args;
+    va_start(args, fmt);
+    error_log_print(ERROR_LEVEL, fmt, args);
+    va_end(args);
+  }
+};
+
+/** In case of an error, a message is printed to the error log. */
+static General_log_table_intact glt_intact;
+
 LOGGER logger;
 
 static bool test_if_number(const char *str,
@@ -275,7 +411,7 @@ bool Log_to_csv_event_handler::
                             TL_WRITE_CONCURRENT_INSERT);
 
   /*
-    1) open_log_table generates an error of the
+    1) open_log_table generates an error if the
     table can not be opened or is corrupted.
     2) "INSERT INTO general_log" can generate warning sometimes.
 
@@ -293,6 +429,9 @@ bool Log_to_csv_event_handler::
 
   need_close= TRUE;
 
+  if (glt_intact.check(table_list.table, &general_log_table_def))
+    goto err;
+
   if (table->file->extra(HA_EXTRA_MARK_AS_LOG_TABLE) ||
       table->file->ha_rnd_init(0))
     goto err;
@@ -316,35 +455,40 @@ bool Log_to_csv_event_handler::
   if (table->s->fields < 6)
     goto err;
 
-  DBUG_ASSERT(table->field[0]->type() == MYSQL_TYPE_TIMESTAMP);
+  DBUG_ASSERT(table->field[GLT_FIELD_EVENT_TIME]->type() == MYSQL_TYPE_TIMESTAMP);
 
-  ((Field_timestamp*) table->field[0])->store_timestamp((my_time_t)
-                                                        event_time);
+  ((Field_timestamp*) table->field[GLT_FIELD_EVENT_TIME])->store_timestamp(
+      (my_time_t) event_time);
 
   /* do a write */
-  if (table->field[1]->store(user_host, user_host_len, client_cs) ||
-      table->field[2]->store((longlong) thread_id, TRUE) ||
-      table->field[3]->store((longlong) server_id, TRUE) ||
-      table->field[4]->store(command_type, command_type_len, client_cs))
+  if (table->field[GLT_FIELD_USER_HOST]->store(user_host, user_host_len,
+                                               client_cs) ||
+      table->field[GLT_FIELD_THREAD_ID]->store((longlong) thread_id, TRUE) ||
+      table->field[GLT_FIELD_SERVER_ID]->store((longlong) server_id, TRUE) ||
+      table->field[GLT_FIELD_COMMAND_TYPE]->store(command_type,
+                                                  command_type_len, client_cs))
     goto err;
 
   /*
     A positive return value in store() means truncation.
     Still logging a message in the log in this case.
   */
-  table->field[5]->flags|= FIELDFLAG_HEX_ESCAPE;
-  if (table->field[5]->store(sql_text, sql_text_len, client_cs) < 0)
+  table->field[GLT_FIELD_ARGUMENT]->flags|= FIELDFLAG_HEX_ESCAPE;
+  if (table->field[GLT_FIELD_ARGUMENT]->store(sql_text, sql_text_len,
+                                              client_cs) < 0)
     goto err;
 
   /* mark all fields as not null */
-  table->field[1]->set_notnull();
-  table->field[2]->set_notnull();
-  table->field[3]->set_notnull();
-  table->field[4]->set_notnull();
-  table->field[5]->set_notnull();
+  table->field[GLT_FIELD_USER_HOST]->set_notnull();
+  table->field[GLT_FIELD_THREAD_ID]->set_notnull();
+  table->field[GLT_FIELD_SERVER_ID]->set_notnull();
+  table->field[GLT_FIELD_COMMAND_TYPE]->set_notnull();
+  table->field[GLT_FIELD_ARGUMENT]->set_notnull();
 
   /* Set any extra columns to their default values */
-  for (field_index= 6 ; field_index < table->s->fields ; field_index++)
+  for (field_index= GLT_FIELD_COUNT ;
+       field_index < table->s->fields ;
+       field_index++)
   {
     table->field[field_index]->set_default();
   }
@@ -439,6 +583,9 @@ bool Log_to_csv_event_handler::
 
   need_close= TRUE;
 
+  if (sqlt_intact.check(table_list.table, &slow_query_log_table_def))
+    goto err;
+
   if (table->file->extra(HA_EXTRA_MARK_AS_LOG_TABLE) ||
       table->file->ha_rnd_init(0))
     goto err;
@@ -450,15 +597,12 @@ bool Log_to_csv_event_handler::
 
   restore_record(table, s->default_values);    // Get empty record
 
-  /* check that all columns exist */
-  if (table->s->fields < 11)
-    goto err;
-
   /* store the time and user values */
-  DBUG_ASSERT(table->field[0]->type() == MYSQL_TYPE_TIMESTAMP);
-  ((Field_timestamp*) table->field[0])->store_timestamp((my_time_t)
-                                                        current_time);
-  if (table->field[1]->store(user_host, user_host_len, client_cs))
+  DBUG_ASSERT(table->field[SQLT_FIELD_START_TIME]->type() == MYSQL_TYPE_TIMESTAMP);
+  ((Field_timestamp*) table->field[SQLT_FIELD_START_TIME])->store_timestamp(
+      (my_time_t) current_time);
+  if (table->field[SQLT_FIELD_USER_HOST]->store(user_host, user_host_len,
+                                                client_cs))
     goto err;
 
   if (query_start_arg)
@@ -475,42 +619,43 @@ bool Log_to_csv_event_handler::
 
     /* fill in query_time field */
     calc_time_from_sec(&t, (long) min(query_time, (longlong) TIME_MAX_VALUE_SECONDS), 0);
-    if (table->field[2]->store_time(&t, MYSQL_TIMESTAMP_TIME))
+    if (table->field[SQLT_FIELD_QUERY_TIME]->store_time(&t, MYSQL_TIMESTAMP_TIME))
       goto err;
     /* lock_time */
     calc_time_from_sec(&t, (long) min(lock_time, (longlong) TIME_MAX_VALUE_SECONDS), 0);
-    if (table->field[3]->store_time(&t, MYSQL_TIMESTAMP_TIME))
+    if (table->field[SQLT_FIELD_LOCK_TIME]->store_time(&t, MYSQL_TIMESTAMP_TIME))
       goto err;
     /* rows_sent */
-    if (table->field[4]->store((longlong) thd->sent_row_count, TRUE))
+    if (table->field[SQLT_FIELD_ROWS_SENT]->store((longlong) thd->sent_row_count, TRUE))
       goto err;
     /* rows_examined */
-    if (table->field[5]->store((longlong) thd->examined_row_count, TRUE))
+    if (table->field[SQLT_FIELD_ROWS_EXAMINED]->store((longlong) thd->examined_row_count, TRUE))
       goto err;
   }
   else
   {
-    table->field[2]->set_null();
-    table->field[3]->set_null();
-    table->field[4]->set_null();
-    table->field[5]->set_null();
+    table->field[SQLT_FIELD_QUERY_TIME]->set_null();
+    table->field[SQLT_FIELD_LOCK_TIME]->set_null();
+    table->field[SQLT_FIELD_ROWS_SENT]->set_null();
+    table->field[SQLT_FIELD_ROWS_EXAMINED]->set_null();
   }
   /* fill database field */
   if (thd->db)
   {
-    if (table->field[6]->store(thd->db, thd->db_length, client_cs))
+    if (table->field[SQLT_FIELD_DATABASE]->store(thd->db, thd->db_length,
+                                                 client_cs))
       goto err;
-    table->field[6]->set_notnull();
+    table->field[SQLT_FIELD_DATABASE]->set_notnull();
   }
 
   if (thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt)
   {
     if (table->
-        field[7]->store((longlong)
+        field[SQLT_FIELD_LAST_INSERT_ID]->store((longlong)
                         thd->first_successful_insert_id_in_prev_stmt_for_binlog,
                         TRUE))
       goto err;
-    table->field[7]->set_notnull();
+    table->field[SQLT_FIELD_LAST_INSERT_ID]->set_notnull();
   }
 
   /*
@@ -522,22 +667,27 @@ bool Log_to_csv_event_handler::
   if (thd->auto_inc_intervals_in_cur_stmt_for_binlog.nb_elements() > 0)
   {
     if (table->
-        field[8]->store((longlong)
+        field[SQLT_FIELD_INSERT_ID]->store((longlong)
           thd->auto_inc_intervals_in_cur_stmt_for_binlog.minimum(), TRUE))
       goto err;
-    table->field[8]->set_notnull();
+    table->field[SQLT_FIELD_INSERT_ID]->set_notnull();
   }
 
-  if (table->field[9]->store((longlong) server_id, TRUE))
+  if (table->field[SQLT_FIELD_SERVER_ID]->store((longlong) server_id, TRUE))
     goto err;
-  table->field[9]->set_notnull();
+  table->field[SQLT_FIELD_SERVER_ID]->set_notnull();
 
   /*
     Column sql_text.
     A positive return value in store() means truncation.
     Still logging a message in the log in this case.
   */
-  if (table->field[10]->store(sql_text, sql_text_len, client_cs) < 0)
+  if (table->field[SQLT_FIELD_SQL_TEXT]->store(sql_text, sql_text_len,
+                                               client_cs) < 0)
+    goto err;
+
+  if (table->field[SQLT_FIELD_THREAD_ID]->store((longlong) thd->thread_id,
+                                                TRUE))
     goto err;
 
   /* log table entries are not replicated */
@@ -1769,12 +1919,9 @@ bool MYSQL_QUERY_LOG::write(THD *thd, ti
         if (my_b_write(&log_file, (uchar*) buff, buff_len))
           tmp_errno= errno;
       }
-      const uchar uh[]= "# User@Host: ";
-      if (my_b_write(&log_file, uh, sizeof(uh) - 1))
-        tmp_errno= errno;
-      if (my_b_write(&log_file, (uchar*) user_host, user_host_len))
-        tmp_errno= errno;
-      if (my_b_write(&log_file, (uchar*) "\n", 1))
+      buff_len= my_snprintf(buff, 14, "%5ld", (long) thd->thread_id);
+      if (my_b_printf(&log_file, "# User@Host: %s  Id: %s\n", user_host, buff)
+          == (uint) -1)
         tmp_errno= errno;
     }
     /* For slow query log */

=== modified file 'sql/log.h'
--- a/sql/log.h	2010-12-10 16:55:50 +0000
+++ b/sql/log.h	2011-02-09 08:12:43 +0000
@@ -216,6 +216,37 @@ public:
 #endif
 };
 
+
+enum enum_general_log_table_field
+{
+  GLT_FIELD_EVENT_TIME = 0,
+  GLT_FIELD_USER_HOST,
+  GLT_FIELD_THREAD_ID,
+  GLT_FIELD_SERVER_ID,
+  GLT_FIELD_COMMAND_TYPE,
+  GLT_FIELD_ARGUMENT,
+  GLT_FIELD_COUNT
+};
+
+
+enum enum_slow_query_log_table_field
+{
+  SQLT_FIELD_START_TIME = 0,
+  SQLT_FIELD_USER_HOST,
+  SQLT_FIELD_QUERY_TIME,
+  SQLT_FIELD_LOCK_TIME,
+  SQLT_FIELD_ROWS_SENT,
+  SQLT_FIELD_ROWS_EXAMINED,
+  SQLT_FIELD_DATABASE,
+  SQLT_FIELD_LAST_INSERT_ID,
+  SQLT_FIELD_INSERT_ID,
+  SQLT_FIELD_SERVER_ID,
+  SQLT_FIELD_SQL_TEXT,
+  SQLT_FIELD_THREAD_ID,
+  SQLT_FIELD_COUNT
+};
+
+
 class MYSQL_QUERY_LOG: public MYSQL_LOG
 {
 public:

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-02-04 05:11:09 +0000
+++ b/sql/mysqld.cc	2011-02-10 11:48:58 +0000
@@ -5139,11 +5139,17 @@ static bool read_init_file(char *file_na
   MYSQL_FILE *file;
   DBUG_ENTER("read_init_file");
   DBUG_PRINT("enter",("name: %s",file_name));
+
+  sql_print_information("Execution of init_file \'%s\' started.", file_name);
+
   if (!(file= mysql_file_fopen(key_file_init, file_name,
                                O_RDONLY, MYF(MY_WME))))
     DBUG_RETURN(TRUE);
   bootstrap(file);
   mysql_file_fclose(file, MYF(MY_WME));
+
+  sql_print_information("Execution of init_file \'%s\' ended.", file_name);
+
   DBUG_RETURN(FALSE);
 }
 

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2011-02-02 18:31:39 +0000
+++ b/sql/sys_vars.cc	2011-02-10 11:48:58 +0000
@@ -359,6 +359,9 @@ static bool fix_binlog_format_after_upda
   return false;
 }
 
+static Sys_var_test_flag Sys_core_file(
+       "core_file", "write a core-file on crashes", TEST_CORE_ON_SIGNAL);
+
 static Sys_var_enum Sys_binlog_format(
        "binlog_format", "What form of binary logging the master will "
        "use: either ROW for row-based binary logging, STATEMENT "
@@ -1520,7 +1523,7 @@ static Sys_var_proxy_user Sys_proxy_user
        "proxy_user", "The proxy user account name used when logging in",
        IN_SYSTEM_CHARSET);
 
-static Sys_var_external_user Sys_exterenal_user(
+static Sys_var_external_user Sys_external_user(
        "external_user", "The external user account used when logging in",
        IN_SYSTEM_CHARSET);
 

=== modified file 'sql/sys_vars.h'
--- a/sql/sys_vars.h	2010-12-21 15:27:40 +0000
+++ b/sql/sys_vars.h	2011-02-10 05:29:15 +0000
@@ -842,6 +842,35 @@ public:
 };
 
 /**
+  The class for @test_flags (core_file for now).
+  It's derived from Sys_var_mybool.
+
+  Class specific constructor arguments:
+    Caller need not pass in a variable as we make up the value on the
+    fly, that is, we derive it from the global test_flags bit vector.
+
+  Backing store: my_bool
+*/
+class Sys_var_test_flag: public Sys_var_mybool
+{
+private:
+  my_bool test_flag_value;
+  uint    test_flag_mask;
+public:
+  Sys_var_test_flag(const char *name_arg, const char *comment, uint mask)
+  : Sys_var_mybool(name_arg, comment, READ_ONLY GLOBAL_VAR(test_flag_value),
+          NO_CMD_LINE, DEFAULT(FALSE))
+  {
+    test_flag_mask= mask;
+  }
+  uchar *global_value_ptr(THD *thd, LEX_STRING *base)
+  {
+    test_flag_value= ((test_flags & test_flag_mask) > 0);
+    return (uchar*) &test_flag_value;
+  }
+};
+
+/**
   The class for the @max_user_connections.
   It's derived from Sys_var_uint, but non-standard session value
   requires a new class.

No bundle (reason: revision is a merge (you can force generation of a bundle with env var BZR_FORCE_BUNDLE=1)).
Thread
bzr commit into mysql-trunk branch (azundris:3638) Tatiana Azundris Nurnberg10 Feb