Commit 0977734c authored by Igor Babaev's avatar Igor Babaev

Fixed all remaining failures in partition tests.

Commented out the test case for bug 50036 as it was done in mysql-5.6.10.
parent 24b9c175
......@@ -9,7 +9,7 @@ PARTITION BY RANGE (id)
PARTITION pmax VALUES LESS THAN (MAXVALUE));
INSERT INTO t1 VALUES (1), (10), (100), (1000);
ALTER TABLE t1 TRUNCATE PARTITION p1;
ERROR HY000: Incorrect partition name
ERROR HY000: Unknown partition 'p1' in table 't1'
ALTER TABLE t1 DROP PARTITION p1;
ERROR HY000: Error in list of partitions to DROP
# No error returned, output in table format instead:
......
......@@ -20,14 +20,15 @@ PARTITION p2 VALUES LESS THAN (100),
PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
SET SESSION debug_dbug= "+d,sleep_before_create_table_no_lock";
SET DEBUG_SYNC= 'alter_table_before_create_table_no_lock SIGNAL removing_partitioning WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL partitioning_removed';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL waiting_for_upgrade';
ALTER TABLE t1 REMOVE PARTITIONING;
# Con default
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitioning';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL waiting_for_alter';
SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table WAIT_FOR partitioning_removed';
SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table WAIT_FOR waiting_for_upgrade';
DROP TABLE IF EXISTS t1;
# Con 1
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SET SESSION debug_dbug= "-d,sleep_before_create_table_no_lock";
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'RESET';
......
......@@ -98,7 +98,7 @@ PARTITION BY KEY (a)
(PARTITION x0, PARTITION x1);
ALTER TABLE t1 ADD PARTITION PARTITIONS 0;
ERROR HY000: At least one partition must be added
ALTER TABLE t1 ADD PARTITION PARTITIONS 1024;
ALTER TABLE t1 ADD PARTITION PARTITIONS 8192;
ERROR HY000: Too many partitions (including subpartitions) were defined
ALTER TABLE t1 DROP PARTITION x0;
ERROR HY000: DROP PARTITION can only be used on RANGE/LIST partitions
......
DROP TABLE IF EXISTS t1, t2;
#
# Bug#50036: Inconsistent errors when using TIMESTAMP
# columns/expressions
# Added test with existing TIMESTAMP partitioning (when it was allowed).
CREATE TABLE t1 (a TIMESTAMP)
ENGINE = MyISAM
PARTITION BY HASH (UNIX_TIMESTAMP(a));
INSERT INTO t1 VALUES ('2000-01-02 03:04:05');
SELECT * FROM t1;
a
2000-01-02 03:04:05
FLUSH TABLES;
# replacing t1.frm with TO_DAYS(a) which was allowed earlier.
# Disable warnings, since the result would differ when running with
# --ps-protocol (only for the 'SELECT * FROM t1' statement).
SELECT * FROM t1;
a
2000-01-02 03:04:05
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=<curr_engine> DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a)) */
INSERT INTO t1 VALUES ('2001-02-03 04:05:06');
SELECT * FROM t1;
a
2000-01-02 03:04:05
2001-02-03 04:05:06
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
Warnings:
Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE t1
PARTITION BY RANGE (TO_DAYS(a))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a))
PARTITIONS 3 */
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a))
PARTITIONS 3 */
Warnings:
Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
DROP TABLE t2;
CREATE TABLE t2 SELECT * FROM t1;
DROP TABLE t2;
ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a)) */
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a))
PARTITIONS 3 */
SELECT * FROM t1;
a
2000-01-02 03:04:05
2001-02-03 04:05:06
DROP TABLE t1;
#
# Bug#31931: Mix of handlers error message
#
CREATE TABLE t1 (a INT)
......@@ -109,7 +32,7 @@ ERROR HY000: Failed to read from the .par file
# Note that it is currently impossible to drop a partitioned table
# without the .par file
DROP TABLE t1;
ERROR 42S02: Unknown table 't1'
ERROR 42S02: Unknown table 'test.t1'
#
# Bug#50392: insert_id is not reset for partitioned tables
# auto_increment on duplicate entry
......
......@@ -20,7 +20,7 @@ INSERT INTO t1 VALUES (1), (10), (100), (1000);
--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1)
--error ER_WRONG_PARTITION_NAME
--error ER_UNKNOWN_PARTITION
ALTER TABLE t1 TRUNCATE PARTITION p1;
--error ER_DROP_PARTITION_NON_EXISTENT
ALTER TABLE t1 DROP PARTITION p1;
......
......@@ -32,16 +32,17 @@ ENGINE = MYISAM
PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
SET SESSION debug_dbug= "+d,sleep_before_create_table_no_lock";
SET DEBUG_SYNC= 'alter_table_before_create_table_no_lock SIGNAL removing_partitioning WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL partitioning_removed';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL waiting_for_upgrade';
--send ALTER TABLE t1 REMOVE PARTITIONING
connection default;
--echo # Con default
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitioning';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL waiting_for_alter';
SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table WAIT_FOR partitioning_removed';
SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table WAIT_FOR waiting_for_upgrade';
DROP TABLE IF EXISTS t1;
--echo # Con 1
connection con1;
--error ER_LOCK_DEADLOCK
--reap
SET SESSION debug_dbug= "-d,sleep_before_create_table_no_lock";
connection default;
......
......@@ -147,7 +147,7 @@ PARTITION BY KEY (a)
ALTER TABLE t1 ADD PARTITION PARTITIONS 0;
--error ER_TOO_MANY_PARTITIONS_ERROR
ALTER TABLE t1 ADD PARTITION PARTITIONS 1024;
ALTER TABLE t1 ADD PARTITION PARTITIONS 8192;
--error ER_ONLY_ON_RANGE_LIST_PARTITION
ALTER TABLE t1 DROP PARTITION x0;
......
......@@ -11,51 +11,54 @@ DROP TABLE IF EXISTS t1, t2;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
--echo # Bug#50036: Inconsistent errors when using TIMESTAMP
--echo # columns/expressions
--echo # Added test with existing TIMESTAMP partitioning (when it was allowed).
CREATE TABLE t1 (a TIMESTAMP)
ENGINE = MyISAM
PARTITION BY HASH (UNIX_TIMESTAMP(a));
INSERT INTO t1 VALUES ('2000-01-02 03:04:05');
--sorted_result
SELECT * FROM t1;
FLUSH TABLES;
--echo # replacing t1.frm with TO_DAYS(a) which was allowed earlier.
--remove_file $MYSQLD_DATADIR/test/t1.frm
--copy_file std_data/parts/t1TIMESTAMP.frm $MYSQLD_DATADIR/test/t1.frm
--echo # Disable warnings, since the result would differ when running with
--echo # --ps-protocol (only for the 'SELECT * FROM t1' statement).
--disable_warnings
--sorted_result
SELECT * FROM t1;
--enable_warnings
--replace_result MyISAM <curr_engine> InnoDB <curr_engine>
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('2001-02-03 04:05:06');
--sorted_result
SELECT * FROM t1;
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE t1
PARTITION BY RANGE (TO_DAYS(a))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
SHOW CREATE TABLE t1;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
DROP TABLE t2;
CREATE TABLE t2 SELECT * FROM t1;
DROP TABLE t2;
ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a));
SHOW CREATE TABLE t1;
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
DROP TABLE t1;
#
# Disabled by WL#946: binary format for timestamp column is not compatible.
# So the trick with replacing FRM file does not work any more.
#--echo #
#--echo # Bug#50036: Inconsistent errors when using TIMESTAMP
#--echo # columns/expressions
#
#--echo # Added test with existing TIMESTAMP partitioning (when it was allowed).
#CREATE TABLE t1 (a TIMESTAMP)
#ENGINE = MyISAM
#PARTITION BY HASH (UNIX_TIMESTAMP(a));
#INSERT INTO t1 VALUES ('2000-01-02 03:04:05');
#--sorted_result
#SELECT * FROM t1;
#FLUSH TABLES;
#--echo # replacing t1.frm with TO_DAYS(a) which was allowed earlier.
#--remove_file $MYSQLD_DATADIR/test/t1.frm
#--copy_file std_data/parts/t1TIMESTAMP.frm $MYSQLD_DATADIR/test/t1.frm
#--echo # Disable warnings, since the result would differ when running with
#--echo # --ps-protocol (only for the 'SELECT * FROM t1' statement).
#--disable_warnings
#--sorted_result
#SELECT * FROM t1;
#--enable_warnings
#--replace_result MyISAM <curr_engine> InnoDB <curr_engine>
#SHOW CREATE TABLE t1;
#INSERT INTO t1 VALUES ('2001-02-03 04:05:06');
#--sorted_result
#SELECT * FROM t1;
#ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
#--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
#ALTER TABLE t1
#PARTITION BY RANGE (TO_DAYS(a))
#(PARTITION p0 VALUES LESS THAN (10000),
# PARTITION p1 VALUES LESS THAN (MAXVALUE));
#SHOW CREATE TABLE t1;
#CREATE TABLE t2 LIKE t1;
#SHOW CREATE TABLE t2;
#DROP TABLE t2;
#CREATE TABLE t2 SELECT * FROM t1;
#DROP TABLE t2;
#ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a));
#SHOW CREATE TABLE t1;
#ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
#SHOW CREATE TABLE t1;
#--sorted_result
#SELECT * FROM t1;
#DROP TABLE t1;
--echo #
......
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