summaryrefslogtreecommitdiff
path: root/mysql-test/r/log_tables.result
diff options
context:
space:
mode:
authorunknown <malff/marcsql@weblab.(none)>2007-06-13 22:05:22 -0600
committerunknown <malff/marcsql@weblab.(none)>2007-06-13 22:05:22 -0600
commit8b8b28881f3561275658bac76cc150636ecffa1d (patch)
tree4891c6081abc746f7a7839a325d1240327ceee5d /mysql-test/r/log_tables.result
parent4b435ac7c703f2dbd50efc17248961e03c9284c0 (diff)
downloadmariadb-git-8b8b28881f3561275658bac76cc150636ecffa1d.tar.gz
Bug#27857 (Log tables supplies the wrong value for generating AUTO_INCREMENT
numbers) Before this patch, the code in the class Log_to_csv_event_handler, which is used by the global LOGGER object to write to the tables mysql.slow_log and mysql_general_log, was supporting only records of the format defined for these tables in the database creation scripts. Also before this patch, the server would allow, with certain limitations, to perform ALTER TABLE on the LOG TABLES. As implemented, the behavior of the server, with regards to LOG TABLES, is inconsistent: - either ALTER TABLES on LOG TABLES should be prohibited, and the code writing to these tables can make assumptions on the record format, - or ALTER TABLE on LOG TABLES is permitted, in which case the code writing a record to these tables should be more flexible and honor new fields. In particular, adding an AUTO_INCREMENT column to the logs, does not work as expected (per the bug report). Given that the ALTER TABLE on log tables statement has been explicitly implemented to check that the log should be off to perform the operation, and that current test cases already cover this, the user expectation is already set that this is a "feature" and should be supported. With this patch, the server will: - populate AUTO INCREMENT columns if present, - populate any additional column with it's default value when writing a record to the LOG TABLES. Tests are provided, that detail the precise sequence of statements a SUPER user might want to perform to add more columns to the log tables. mysql-test/r/log_tables.result: Test case for bug#27857 mysql-test/t/log_tables.test: Test case for bug#27857 sql/log.cc: Set extra fields in log tables with default values.
Diffstat (limited to 'mysql-test/r/log_tables.result')
-rw-r--r--mysql-test/r/log_tables.result68
1 files changed, 68 insertions, 0 deletions
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index 5a90c22fa06..ce3dabe3a56 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -287,3 +287,71 @@ 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 @old_long_query_time:=@@long_query_time;
+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 NULL NULL 1 SELECT "My own slow query", sleep(2) 2
+START_TIME USER_HOST QUERY_TIME 00:00:00 1 0 test NULL NULL 1 SELECT "My own slow query", sleep(2) 3
+START_TIME USER_HOST QUERY_TIME 00:00:00 1 0 test NULL NULL 1 SELECT "My own slow query", sleep(2) 4
+SET GLOBAL slow_query_log = 0;
+SET SESSION long_query_time =@old_long_query_time;
+FLUSH LOGS;
+ALTER TABLE mysql.slow_log DROP COLUMN seq;
+ALTER TABLE mysql.slow_log ENGINE = CSV;