From: Mattias Jonsson Date: October 29 2010 10:20am Subject: bzr commit into mysql-trunk-bugfixing branch (mattias.jonsson:3302) Bug#57708 List-Archive: http://lists.mysql.com/commits/122291 X-Bug: 57708 Message-Id: <201010291021.o9TAL8ig017421@acsinet15.oracle.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2268415403235345788==" --===============2268415403235345788== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #At file:///Users/mattiasj/mysql-bzr/b57708-trunk-bf/ based on revid:vasil.dimov@stripped 3302 Mattias Jonsson 2010-10-29 Bug#57708: EXCHANGE PARTITION misuses IGNORE First problem was that IGNORE was used for skipping the whole validation step (check of all rows in the table to fit into the partition) instead of changing every row error into a warning. Second problem was that IGNORE opened up the possibility for bugs like 55944. Solution was to remove the IGNORE option from EXCHANGE PARTITION WITH TABLE (WL#4445). @ mysql-test/r/partition_exchange.result Updated the results @ mysql-test/t/partition_exchange.test Removed the IGNORE option from EXCHANGE PARTITION (wl#4445) @ sql/sql_partition_admin.cc Removed the IGNORE option from EXCHANGE PARTITION (wl#4445) @ sql/sql_yacc.yy Removed the IGNORE option from EXCHANGE PARTITION (wl#4445) modified: mysql-test/r/partition_exchange.result mysql-test/t/partition_exchange.test sql/sql_partition_admin.cc sql/sql_yacc.yy === modified file 'mysql-test/r/partition_exchange.result' --- a/mysql-test/r/partition_exchange.result 2010-10-19 12:00:33 +0000 +++ b/mysql-test/r/partition_exchange.result 2010-10-29 10:20:18 +0000 @@ -135,46 +135,6 @@ a b 64 Sixty four ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t; ERROR HY000: Found row that does not match the partition -ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE; -SHOW CREATE TABLE t; -Table Create Table -t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', - `b` varchar(55) DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -SHOW CREATE TABLE tp; -Table Create Table -tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', - `b` varchar(55) DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) -(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ -SELECT * FROM t; -a b -161 161 -162 162 -163 163 -164 164 -200 Two hundred, end of values -SELECT * FROM tp; -a b -1 First value -10 Ten -2 First value -3 Three -5 Five -50 Fifty -61 Sixty one -62 Sixty two -63 Sixty three -64 Sixty four -99 End of values -# No need to use ignore on the original partition -ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( @@ -213,15 +173,19 @@ a b 63 Sixty three 64 Sixty four # Test list of partitions +ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IGNORE' at line 1 ALTER TABLE tp EXCHANGE PARTITION p0,p1 WITH TABLE t IGNORE; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'p1 WITH TABLE t IGNORE' at line 1 +ALTER TABLE tp EXCHANGE PARTITION p0,p1 WITH TABLE t; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'p1 WITH TABLE t' at line 1 ALTER TABLE tp EXCHANGE PARTITION (p0,p1) WITH TABLE t; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(p0,p1) WITH TABLE t' at line 1 -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE (t,t2) IGNORE; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(t,t2) IGNORE' at line 1 +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE (t,t2); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(t,t2)' at line 1 ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t,t2; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't2' at line 1 -ALTER TABLE tp EXCHANGE PARTITION non_existent WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION non_existent WITH TABLE t; ERROR HY000: Unknown partition 'non_existent' in table 'tp' ALTER TABLE tsp EXCHANGE PARTITION p0 WITH TABLE t; ERROR HY000: Subpartitioned table, use subpartition instead of partition @@ -280,7 +244,7 @@ a b 63 Sixty three 64 Sixty four # Test exchange partition -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( @@ -356,46 +320,8 @@ a b 62 Sixty two 63 Sixty three 64 Sixty four -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; -SHOW CREATE TABLE t; -Table Create Table -t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', - `b` varchar(55) DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -SHOW CREATE TABLE tp; -Table Create Table -tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', - `b` varchar(55) DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) -(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ -SELECT * FROM t; -a b -10 Ten -2 First value -50 Fifty -61 Sixty one -62 Sixty two -63 Sixty three -64 Sixty four -SELECT * FROM tp; -a b -1 First value -161 161 -162 162 -163 163 -164 164 -200 Two hundred, end of values -3 Three -5 Five -99 End of values -# Test exchange subpartition with IGNORE -ALTER TABLE tsp EXCHANGE PARTITION sp3 WITH TABLE t IGNORE; +# Test exchange subpartition +ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( @@ -420,28 +346,25 @@ SUBPARTITION BY HASH (a) SUBPARTITION sp3 ENGINE = MyISAM)) */ SELECT * FROM t; a b -161 161 -163 163 +61 Sixty one +63 Sixty three SELECT * FROM tsp; a b +1 First value 10 Ten -10 Ten +161 161 162 162 +163 163 164 164 2 First value -2 First value 200 Two hundred, end of values +3 Three +5 Five 50 Fifty -50 Fifty -61 Sixty one -61 Sixty one -62 Sixty two 62 Sixty two -63 Sixty three -63 Sixty three -64 Sixty four 64 Sixty four -ALTER TABLE tsp EXCHANGE PARTITION sp3 WITH TABLE t IGNORE; +99 End of values +ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t; ALTER TABLE t ENGINE = InnoDB; ALTER TABLE tp ENGINE = InnoDB; SHOW CREATE TABLE t; @@ -463,25 +386,25 @@ tp CREATE TABLE `tp` ( PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ SELECT * FROM t; a b -10 Ten -2 First value -50 Fifty -61 Sixty one -62 Sixty two -63 Sixty three -64 Sixty four +1 First value +3 Three +5 Five +99 End of values SELECT * FROM tp; a b -1 First value +10 Ten 161 161 162 162 163 163 164 164 +2 First value 200 Two hundred, end of values -3 Three -5 Five -99 End of values -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +50 Fifty +61 Sixty one +62 Sixty two +63 Sixty three +64 Sixty four +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( @@ -501,25 +424,25 @@ tp CREATE TABLE `tp` ( PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ SELECT * FROM t; a b -1 First value -3 Three -5 Five -99 End of values -SELECT * FROM tp; -a b 10 Ten -161 161 -162 162 -163 163 -164 164 2 First value -200 Two hundred, end of values 50 Fifty 61 Sixty one 62 Sixty two 63 Sixty three 64 Sixty four -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +SELECT * FROM tp; +a b +1 First value +161 161 +162 162 +163 163 +164 164 +200 Two hundred, end of values +3 Three +5 Five +99 End of values +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; # test different engines ALTER TABLE t ENGINE = MyISAM; ALTER TABLE tp ENGINE = InnoDB; @@ -540,7 +463,7 @@ tp CREATE TABLE `tp` ( /*!50100 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL SHOW CREATE TABLE t; Table Create Table @@ -566,7 +489,7 @@ INSERT INTO tmp SELECT * FROM t; RENAME TABLE t TO tmp2, tmp TO t; ALTER TABLE tp ENGINE = MyISAM; ALTER TABLE t CHARACTER SET = koi8r COLLATE koi8r_general_ci; -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; ERROR HY000: Non matching attribute 'CHARACTER SET' between partition and table DROP TABLE t; # Test multiple different table options @@ -592,7 +515,7 @@ tp CREATE TABLE `tp` ( /*!50100 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; ERROR HY000: Non matching attribute 'MAX_ROWS' between partition and table SHOW WARNINGS; Level Code Message @@ -603,7 +526,7 @@ RENAME TABLE tmp2 TO t; ALTER TABLE t ADD KEY ba_key (b, a); ALTER TABLE tp ADD KEY ba_key (b, a); ALTER TABLE tsp ADD KEY ba_key (b, a); -ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( @@ -625,35 +548,35 @@ tp CREATE TABLE `tp` ( PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ SELECT * FROM t; a b -161 161 -162 162 -163 163 -164 164 -200 Two hundred, end of values -SELECT * FROM tp; -a b -1 First value 10 Ten 2 First value -3 Three -5 Five 50 Fifty 61 Sixty one 62 Sixty two 63 Sixty three 64 Sixty four +SELECT * FROM tp; +a b +1 First value +161 161 +162 162 +163 163 +164 164 +200 Two hundred, end of values +3 Three +5 Five 99 End of values -ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; ALTER TABLE t DROP KEY ba_key; -ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; ERROR HY000: Tables have different definitions ALTER TABLE t ADD KEY b_key (b); -ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t IGNORE; +ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t; ERROR HY000: Tables have different definitions ALTER TABLE t ADD KEY ba_key (b, a); ALTER TABLE t DROP KEY b_key; ALTER TABLE t CHANGE a c INT; -ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t IGNORE; +ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t; ERROR HY000: Tables have different definitions ALTER TABLE t CHANGE c a INT; # test temporary table @@ -682,7 +605,7 @@ tp CREATE TABLE `tp` ( /*!50100 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; ERROR HY000: Table to exchange with partition is temporary: 't' SHOW CREATE TABLE t; Table Create Table @@ -707,7 +630,7 @@ DROP TEMPORARY TABLE t; ALTER TABLE tmp2 RENAME TO t; # Test non partitioned table ALTER TABLE tp REMOVE PARTITIONING; -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; ERROR HY000: Partition management on a not partitioned table is not possible DROP TABLE t, tp, tsp; # Test with general_log === modified file 'mysql-test/t/partition_exchange.test' --- a/mysql-test/t/partition_exchange.test 2010-08-25 14:00:02 +0000 +++ b/mysql-test/t/partition_exchange.test 2010-10-29 10:20:18 +0000 @@ -73,15 +73,6 @@ SELECT * FROM t; SELECT * FROM tp; --error ER_ROW_DOES_NOT_MATCH_PARTITION ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t; -ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE; -SHOW CREATE TABLE t; -SHOW CREATE TABLE tp; ---sorted_result -SELECT * FROM t; ---sorted_result -SELECT * FROM tp; ---echo # No need to use ignore on the original partition -ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t; SHOW CREATE TABLE t; SHOW CREATE TABLE tp; --sorted_result @@ -90,15 +81,19 @@ SELECT * FROM t; SELECT * FROM tp; --echo # Test list of partitions --error ER_PARSE_ERROR +ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE; +--error ER_PARSE_ERROR ALTER TABLE tp EXCHANGE PARTITION p0,p1 WITH TABLE t IGNORE; --error ER_PARSE_ERROR +ALTER TABLE tp EXCHANGE PARTITION p0,p1 WITH TABLE t; +--error ER_PARSE_ERROR ALTER TABLE tp EXCHANGE PARTITION (p0,p1) WITH TABLE t; --error ER_PARSE_ERROR -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE (t,t2) IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE (t,t2); --error ER_PARSE_ERROR ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t,t2; --error ER_UNKNOWN_PARTITION -ALTER TABLE tp EXCHANGE PARTITION non_existent WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION non_existent WITH TABLE t; --error ER_PARTITION_INSTEAD_OF_SUBPARTITION ALTER TABLE tsp EXCHANGE PARTITION p0 WITH TABLE t; --error ER_PARTITION_EXCHANGE_PART_TABLE @@ -111,13 +106,6 @@ SELECT * FROM t; --sorted_result SELECT * FROM tp; --echo # Test exchange partition -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; -SHOW CREATE TABLE t; -SHOW CREATE TABLE tp; ---sorted_result -SELECT * FROM t; ---sorted_result -SELECT * FROM tp; ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW CREATE TABLE t; SHOW CREATE TABLE tp; @@ -132,15 +120,15 @@ SHOW CREATE TABLE tp; SELECT * FROM t; --sorted_result SELECT * FROM tp; ---echo # Test exchange subpartition with IGNORE -ALTER TABLE tsp EXCHANGE PARTITION sp3 WITH TABLE t IGNORE; +--echo # Test exchange subpartition +ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t; SHOW CREATE TABLE t; SHOW CREATE TABLE tsp; --sorted_result SELECT * FROM t; --sorted_result SELECT * FROM tsp; -ALTER TABLE tsp EXCHANGE PARTITION sp3 WITH TABLE t IGNORE; +ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t; ALTER TABLE t ENGINE = InnoDB; ALTER TABLE tp ENGINE = InnoDB; SHOW CREATE TABLE t; @@ -149,21 +137,21 @@ SHOW CREATE TABLE tp; SELECT * FROM t; --sorted_result SELECT * FROM tp; -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW CREATE TABLE t; SHOW CREATE TABLE tp; --sorted_result SELECT * FROM t; --sorted_result SELECT * FROM tp; -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; --echo # test different engines ALTER TABLE t ENGINE = MyISAM; ALTER TABLE tp ENGINE = InnoDB; SHOW CREATE TABLE t; SHOW CREATE TABLE tp; --error ER_MIX_HANDLER_ERROR -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW CREATE TABLE t; SHOW CREATE TABLE tp; --echo # Test different charsets @@ -174,7 +162,7 @@ RENAME TABLE t TO tmp2, tmp TO t; ALTER TABLE tp ENGINE = MyISAM; ALTER TABLE t CHARACTER SET = koi8r COLLATE koi8r_general_ci; --error ER_PARTITION_EXCHANGE_DIFFERENT_OPTION -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; DROP TABLE t; --echo # Test multiple different table options CREATE TABLE t (a INT, @@ -185,7 +173,7 @@ INSERT INTO t SELECT * FROM tmp2; SHOW CREATE TABLE t; SHOW CREATE TABLE tp; --error ER_PARTITION_EXCHANGE_DIFFERENT_OPTION -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW WARNINGS; DROP TABLE t; RENAME TABLE tmp2 TO t; @@ -193,27 +181,27 @@ RENAME TABLE tmp2 TO t; ALTER TABLE t ADD KEY ba_key (b, a); ALTER TABLE tp ADD KEY ba_key (b, a); ALTER TABLE tsp ADD KEY ba_key (b, a); -ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW CREATE TABLE t; SHOW CREATE TABLE tp; --sorted_result SELECT * FROM t; --sorted_result SELECT * FROM tp; -ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; ALTER TABLE t DROP KEY ba_key; --error ER_TABLES_DIFFERENT_METADATA -ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; ALTER TABLE t ADD KEY b_key (b); --error ER_TABLES_DIFFERENT_METADATA -ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t IGNORE; +ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t; ALTER TABLE t ADD KEY ba_key (b, a); ALTER TABLE t DROP KEY b_key; # test different index types # test different columns ALTER TABLE t CHANGE a c INT; --error ER_TABLES_DIFFERENT_METADATA -ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t IGNORE; +ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t; ALTER TABLE t CHANGE c a INT; # test different data/index dir # test different options (row_format, max/min_rows, comments, tablespace, @@ -229,7 +217,7 @@ ALTER TABLE tmp RENAME TO t; SHOW CREATE TABLE t; SHOW CREATE TABLE tp; --error ER_PARTITION_EXCHANGE_TEMP_TABLE -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW CREATE TABLE t; SHOW CREATE TABLE tp; DROP TEMPORARY TABLE t; @@ -237,7 +225,7 @@ ALTER TABLE tmp2 RENAME TO t; --echo # Test non partitioned table ALTER TABLE tp REMOVE PARTITIONING; --error ER_PARTITION_MGMT_ON_NONPARTITIONED -ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE; +ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; # TODO: # Verify that it is possible to read a table that is going to be exchanged === modified file 'sql/sql_partition_admin.cc' --- a/sql/sql_partition_admin.cc 2010-10-28 10:10:28 +0000 +++ b/sql/sql_partition_admin.cc 2010-10-29 10:20:18 +0000 @@ -446,13 +446,13 @@ err_no_action_written: @brief Swap places between a partition and a table. @details Verify that the tables are compatible (same engine, definition etc), - if not IGNORE is given, verify that all rows in the table will fit in the - partition, if all OK, rename table to tmp name, rename partition to table + verify that all rows in the table will fit in the partition, + if all OK, rename table to tmp name, rename partition to table and finally rename tmp name to partition. 1) Take upgradable mdl, open tables and then lock them (inited in parse) 2) Verify that metadata matches - 3) If not ignore, verify data + 3) verify data 4) Upgrade to exclusive mdl for both tables 5) Rename table <-> partition 6) Rely on close_thread_tables to release mdl and table locks @@ -461,7 +461,6 @@ err_no_action_written: @param table_list Table where the partition exists as first table, Table to swap with the partition as second table @param alter_info Contains partition name to swap - @param ignore flag to skip verification of partition values @note This is a DDL operation so triggers will not be used. */ @@ -482,7 +481,7 @@ bool Alter_table_exchange_partition_stat Alter_table_prelocking_strategy alter_prelocking_strategy(alter_info); MDL_ticket *swap_table_mdl_ticket= NULL; MDL_ticket *part_table_mdl_ticket= NULL; - bool error= TRUE, ignore= m_lex->ignore; + bool error= TRUE; DBUG_ENTER("mysql_exchange_partition"); DBUG_ASSERT(alter_info->flags & ALTER_EXCHANGE_PARTITION); @@ -572,11 +571,10 @@ bool Alter_table_exchange_partition_stat /* Table and partition has same structure/options, OK to exchange */ - if (!ignore) - { - if (verify_data_with_partition(swap_table, part_table, swap_part_id)) - DBUG_RETURN(TRUE); - } + thd_proc_info(thd, "verifying data with partition"); + + if (verify_data_with_partition(swap_table, part_table, swap_part_id)) + DBUG_RETURN(TRUE); /* Get exclusive mdl lock on both tables, alway the non partitioned table === modified file 'sql/sql_yacc.yy' --- a/sql/sql_yacc.yy 2010-10-13 09:34:28 +0000 +++ b/sql/sql_yacc.yy 2010-10-29 10:20:18 +0000 @@ -6588,7 +6588,6 @@ alter_commands: if (lex->m_stmt == NULL) MYSQL_YYABORT; } - opt_ignore ; remove_partitioning: --===============2268415403235345788== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/mattias.jonsson@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: mattias.jonsson@stripped\ # g2801v4y71lskygt # target_branch: file:///Users/mattiasj/mysql-bzr/b57708-trunk-bf/ # testament_sha1: 1e08c10553a9481cd1af88cbc6d45885701f289c # timestamp: 2010-10-29 12:20:29 +0200 # base_revision_id: vasil.dimov@stripped\ # 7slm09k3ra5l6h37 # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWUMmjMsACT9fgEAwePf//3// /+D////wYA7/eOvbsI9xtfbvipXr6OexodVb74Chpt875zleXM93ed63dTu5uVeElE1MIyjamyaN Enk9B6iYo08kGhpoNNGmgaAkkCaYgEExKnvRTyT9SntUYTRgNRkZNBkHqBpoTESU2aoeoGyQA9QA AAAAAAJERDQkD1NGqfpT2qep+qPU9Gp5T1AyPU00AA00GgRSQmk/UmMiZT9UeieieRPRHqaABoaA AAAVJIIGjRA0aFTbKmxIaepkabUNo0h6h6n6ptTT0S77uEcxzx0HweTE7Y4mk00p1xpLjUXlQhDD 0pbuzaX3mO+4GwKNjDOMZm32Z+uoFWjBs85Hqx5Bn6237qdQe4DCOiLtIPXeLNK849GZPjfO/5zd C9GYYBWpSCvXrISbXsWEKHypthkxMCLJEmAxxf2iFpJoOXLFtNKLbgdhi/KzOuFkXkB9LSrILRoC 9rhaNWBCW6sBqaJYgbOTriRKu050KsIGFemLkGhF5klXhrOqKNSKfLKNZ7I7/BQSDlx09wMfgG88 f6Ax5auPyipqO58x/k7CpVQlUJVFUnyc88iHX3ce21bDv4zq07LPcbWGNq5XWMLBpVuRhoh5fFnv dEtQaqIZ4ploibWZF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