1call mtr.add_suppression("Failed to write to mysql.general_log"); 2drop table if exists t1; 3create table t1 (a int) 4engine = csv 5partition by list (a) 6(partition p0 values in (null)); 7ERROR HY000: Engine cannot be used in partitioned tables 8USE mysql; 9TRUNCATE TABLE general_log; 10SET @old_general_log_state = @@global.general_log; 11SET GLOBAL general_log = 0; 12ALTER TABLE general_log ENGINE = MyISAM; 13ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time)) 14(PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000)); 15ERROR HY000: Incorrect usage of PARTITION and log table 16ALTER TABLE general_log ENGINE = CSV; 17SET GLOBAL general_log = @old_general_log_state; 18use test; 19# 20# Bug#40281: partitioning the general log table crashes the server 21# 22# set up partitioned log, and switch to it 23USE mysql; 24SET @old_general_log_state = @@global.general_log; 25SET GLOBAL general_log = 0; 26CREATE TABLE gl_partitioned LIKE general_log; 27ALTER TABLE gl_partitioned ENGINE=myisam; 28ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10; 29ALTER TABLE general_log RENAME TO gl_nonpartitioned; 30ALTER TABLE gl_partitioned RENAME TO general_log; 31SELECT @@global.log_output INTO @old_glo; 32SET GLOBAL log_output='table'; 33SET GLOBAL general_log =1; 34# do some things to be logged to partitioned log, should fail 35USE /* 1 */ test; 36CREATE TABLE t1 (i INT); 37connect con1,localhost,root,,; 38INSERT INTO t1 VALUES (1); 39SELECT * FROM t1; 40i 411 42disconnect con1; 43connection default; 44USE mysql; 45SET GLOBAL general_log =0; 46ALTER TABLE general_log RENAME TO gl_partitioned; 47ALTER TABLE gl_nonpartitioned RENAME TO general_log; 48# show whether we actually logged anything (no) to general_log 49SELECT COUNT(argument) FROM gl_partitioned; 50COUNT(argument) 510 52DROP TABLE gl_partitioned; 53SET GLOBAL log_output = @old_glo; 54SET GLOBAL general_log = 1; 55USE /* 2 */ test; 56DROP TABLE t1; 57SET GLOBAL general_log = @old_general_log_state; 58End of 5.1 tests 59