Commit d0f98f38 authored by Davi Arnaut's avatar Davi Arnaut

Test case clean up: Move test cases that depend on the CSV storage

engine to the partition_csv test. Also remove test case that was
duplicated. Fix connection procedure with the embedded server.

mysql-test/r/partition.result:
  Update test case result.
mysql-test/r/partition_csv.result:
  Update test case result.
mysql-test/t/partition.test:
  Move test cases to the partition_csv test.
mysql-test/t/partition_csv.test:
  Move tests from partition.test and remove duplicate.
  Tweaky connection procedure to work with embedded.
parent 276d3dd2
SET @old_general_log= @@global.general_log;
drop table if exists t1, t2; drop table if exists t1, t2;
CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a)) CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a))
ENGINE=MyISAM ENGINE=MyISAM
...@@ -1627,17 +1626,6 @@ create table t (s1 int) engine=myisam partition by key (s1); ...@@ -1627,17 +1626,6 @@ create table t (s1 int) engine=myisam partition by key (s1);
create trigger t_ad after delete on t for each row insert into t values (old.s1); create trigger t_ad after delete on t for each row insert into t values (old.s1);
insert into t values (1); insert into t values (1);
drop table t; drop table t;
USE mysql;
TRUNCATE TABLE general_log;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
ALTER TABLE general_log ENGINE = MyISAM;
ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
(PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
ERROR HY000: Incorrect usage of PARTITION and log table
ALTER TABLE general_log ENGINE = CSV;
SET GLOBAL general_log = @old_general_log_state;
use test;
create table t2 (b int); create table t2 (b int);
create table t1 (b int) create table t1 (b int)
PARTITION BY RANGE (t2.b) ( PARTITION BY RANGE (t2.b) (
...@@ -1997,39 +1985,4 @@ CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM ...@@ -1997,39 +1985,4 @@ CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM
PARTITION BY HASH(id) PARTITIONS 2; PARTITION BY HASH(id) PARTITIONS 2;
DROP TABLE t1; DROP TABLE t1;
SET SESSION SQL_MODE=DEFAULT; SET SESSION SQL_MODE=DEFAULT;
Bug#40281: partitioning the general log table crashes the server
--- set up partitioned log, and switch to it
USE mysql;
SET GLOBAL general_log =0;
CREATE TABLE gl_partitioned LIKE general_log;
ALTER TABLE gl_partitioned ENGINE=myisam;
ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10;
ALTER TABLE general_log RENAME TO gl_nonpartitioned;
ALTER TABLE gl_partitioned RENAME TO general_log;
SELECT @@global.log_output INTO @old_glo;
SET GLOBAL log_output='table';
SET GLOBAL general_log =1;
--- do some things to be logged to partitioned log, should fail
USE /* 1 */ test;
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
i
1
USE mysql;
SET GLOBAL general_log =0;
ALTER TABLE general_log RENAME TO gl_partitioned;
ALTER TABLE gl_nonpartitioned RENAME TO general_log;
--- show whether we actually logged anything (no) to general_log
SELECT COUNT(argument) FROM gl_partitioned;
COUNT(argument)
0
DROP TABLE gl_partitioned;
SET GLOBAL log_output=@old_glo;
SET GLOBAL general_log =1;
USE /* 2 */ test;
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
SET @@global.general_log= @old_general_log;
...@@ -5,11 +5,50 @@ partition by list (a) ...@@ -5,11 +5,50 @@ partition by list (a)
(partition p0 values in (null)); (partition p0 values in (null));
ERROR HY000: Engine cannot be used in partitioned tables ERROR HY000: Engine cannot be used in partitioned tables
USE mysql; USE mysql;
TRUNCATE TABLE general_log;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0; SET GLOBAL general_log = 0;
ALTER TABLE general_log ENGINE = MyISAM; ALTER TABLE general_log ENGINE = MyISAM;
ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time)) ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
(PARTITION p0 VALUES LESS THAN (733144), (PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
PARTITION p1 VALUES LESS THAN (3000000));
ERROR HY000: Incorrect usage of PARTITION and log table ERROR HY000: Incorrect usage of PARTITION and log table
ALTER TABLE general_log ENGINE = CSV; ALTER TABLE general_log ENGINE = CSV;
SET GLOBAL general_log = @old_general_log_state;
use test;
#
# Bug#40281: partitioning the general log table crashes the server
#
# set up partitioned log, and switch to it
USE mysql;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
CREATE TABLE gl_partitioned LIKE general_log;
ALTER TABLE gl_partitioned ENGINE=myisam;
ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10;
ALTER TABLE general_log RENAME TO gl_nonpartitioned;
ALTER TABLE gl_partitioned RENAME TO general_log;
SELECT @@global.log_output INTO @old_glo;
SET GLOBAL log_output='table';
SET GLOBAL general_log =1;
# do some things to be logged to partitioned log, should fail
USE /* 1 */ test;
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
i
1
USE mysql;
SET GLOBAL general_log =0;
ALTER TABLE general_log RENAME TO gl_partitioned;
ALTER TABLE gl_nonpartitioned RENAME TO general_log;
# show whether we actually logged anything (no) to general_log
SELECT COUNT(argument) FROM gl_partitioned;
COUNT(argument)
0
DROP TABLE gl_partitioned;
SET GLOBAL log_output = @old_glo;
SET GLOBAL general_log = 1; SET GLOBAL general_log = 1;
USE /* 2 */ test;
DROP TABLE t1;
SET GLOBAL general_log = @old_general_log_state;
End of 5.1 tests
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
# #
--source include/have_partition.inc --source include/have_partition.inc
SET @old_general_log= @@global.general_log;
--disable_warnings --disable_warnings
drop table if exists t1, t2; drop table if exists t1, t2;
--enable_warnings --enable_warnings
...@@ -1651,23 +1649,6 @@ create trigger t_ad after delete on t for each row insert into t values (old.s1) ...@@ -1651,23 +1649,6 @@ create trigger t_ad after delete on t for each row insert into t values (old.s1)
insert into t values (1); insert into t values (1);
drop table t; drop table t;
#
# Bug #27816: Log tables ran with partitions crashes the server when logging
# is enabled.
#
USE mysql;
TRUNCATE TABLE general_log;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
ALTER TABLE general_log ENGINE = MyISAM;
--error ER_WRONG_USAGE
ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
(PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
ALTER TABLE general_log ENGINE = CSV;
SET GLOBAL general_log = @old_general_log_state;
use test;
# #
# Bug #27084 partitioning by list seems failing when using case # Bug #27084 partitioning by list seems failing when using case
# BUG #18198: Case no longer supported, test case removed # BUG #18198: Case no longer supported, test case removed
...@@ -1998,53 +1979,4 @@ CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM ...@@ -1998,53 +1979,4 @@ CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM
DROP TABLE t1; DROP TABLE t1;
SET SESSION SQL_MODE=DEFAULT; SET SESSION SQL_MODE=DEFAULT;
--echo
--echo Bug#40281: partitioning the general log table crashes the server
--echo
--echo --- set up partitioned log, and switch to it
USE mysql;
SET GLOBAL general_log =0;
CREATE TABLE gl_partitioned LIKE general_log;
ALTER TABLE gl_partitioned ENGINE=myisam;
ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10;
ALTER TABLE general_log RENAME TO gl_nonpartitioned;
ALTER TABLE gl_partitioned RENAME TO general_log;
SELECT @@global.log_output INTO @old_glo;
SET GLOBAL log_output='table';
SET GLOBAL general_log =1;
--echo --- do some things to be logged to partitioned log, should fail
USE /* 1 */ test;
CREATE TABLE t1 (i INT);
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connection master;
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
disconnect master;
connection default;
USE mysql;
SET GLOBAL general_log =0;
ALTER TABLE general_log RENAME TO gl_partitioned;
ALTER TABLE gl_nonpartitioned RENAME TO general_log;
--echo --- show whether we actually logged anything (no) to general_log
SELECT COUNT(argument) FROM gl_partitioned;
DROP TABLE gl_partitioned;
SET GLOBAL log_output=@old_glo;
SET GLOBAL general_log =1;
USE /* 2 */ test;
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
SET @@global.general_log= @old_general_log;
...@@ -24,15 +24,68 @@ partition by list (a) ...@@ -24,15 +24,68 @@ partition by list (a)
(partition p0 values in (null)); (partition p0 values in (null));
# #
# Bug#27816: Log tables ran with partitions crashes the server when logging # Bug #27816: Log tables ran with partitions crashes the server when logging
# is enabled. # is enabled.
# #
USE mysql; USE mysql;
TRUNCATE TABLE general_log;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0; SET GLOBAL general_log = 0;
ALTER TABLE general_log ENGINE = MyISAM; ALTER TABLE general_log ENGINE = MyISAM;
--error ER_WRONG_USAGE --error ER_WRONG_USAGE
ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time)) ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
(PARTITION p0 VALUES LESS THAN (733144), (PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
PARTITION p1 VALUES LESS THAN (3000000));
ALTER TABLE general_log ENGINE = CSV; ALTER TABLE general_log ENGINE = CSV;
SET GLOBAL general_log = @old_general_log_state;
use test;
--echo #
--echo # Bug#40281: partitioning the general log table crashes the server
--echo #
--echo # set up partitioned log, and switch to it
USE mysql;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
CREATE TABLE gl_partitioned LIKE general_log;
ALTER TABLE gl_partitioned ENGINE=myisam;
ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10;
ALTER TABLE general_log RENAME TO gl_nonpartitioned;
ALTER TABLE gl_partitioned RENAME TO general_log;
SELECT @@global.log_output INTO @old_glo;
SET GLOBAL log_output='table';
SET GLOBAL general_log =1;
--echo # do some things to be logged to partitioned log, should fail
USE /* 1 */ test;
CREATE TABLE t1 (i INT);
connect (con1,localhost,root,,);
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
disconnect con1;
connection default;
USE mysql;
SET GLOBAL general_log =0;
ALTER TABLE general_log RENAME TO gl_partitioned;
ALTER TABLE gl_nonpartitioned RENAME TO general_log;
--echo # show whether we actually logged anything (no) to general_log
SELECT COUNT(argument) FROM gl_partitioned;
DROP TABLE gl_partitioned;
SET GLOBAL log_output = @old_glo;
SET GLOBAL general_log = 1; SET GLOBAL general_log = 1;
USE /* 2 */ test;
DROP TABLE t1;
SET GLOBAL general_log = @old_general_log_state;
--echo End of 5.1 tests
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