diff options
author | Anurag Shekhar <anurag.shekhar@sun.com> | 2009-07-24 15:41:23 +0530 |
---|---|---|
committer | Anurag Shekhar <anurag.shekhar@sun.com> | 2009-07-24 15:41:23 +0530 |
commit | 0498988b48b0318a6e7e651b1a948967de201eb9 (patch) | |
tree | d15db783325396e0044e82006c84980650316051 /mysql-test/t/partition_not_embedded.test | |
parent | c6771e7bde520228caa44233e36974a27d862a22 (diff) | |
download | mariadb-git-0498988b48b0318a6e7e651b1a948967de201eb9.tar.gz |
Bug#30102: Rename table does corrupt tables with partition files on failure
Problem was that a failing rename just left the partitions at the state
it was at the failure.
Solution was to try to revert the started rename if a failure occured.
mysql-test/r/partition_not_embedded.result:
Bug#30102: Rename table does corrupt tables with partition files on failure
New result file
mysql-test/t/partition_not_embedded.test:
Bug#30102: Rename table does corrupt tables with partition files on failure
New test file
(list_files does not report the files in embedded)
sql/ha_partition.cc:
Bug#30102: Rename table does corrupt tables with partition files on failure
Better error handling for rename partitions (reverting the started rename
operation)
Different order of files for delete.
sql/handler.cc:
Bug#30102: Rename table does corrupt tables with partition files on failure
Tries to remove as many table files as possible
if the first delete succeeds.
Diffstat (limited to 'mysql-test/t/partition_not_embedded.test')
-rw-r--r-- | mysql-test/t/partition_not_embedded.test | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/mysql-test/t/partition_not_embedded.test b/mysql-test/t/partition_not_embedded.test new file mode 100644 index 00000000000..552c4f99af7 --- /dev/null +++ b/mysql-test/t/partition_not_embedded.test @@ -0,0 +1,69 @@ +-- source include/have_partition.inc +-- source include/not_embedded.inc +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings +let $MYSQLD_DATADIR= `SELECT @@datadir`; + +# +# Bug#30102: rename table does corrupt tables with partition files on failure +# +--echo # Bug#30102 test +CREATE TABLE t1 (a INT) +PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN (6), + PARTITION `p1....................` VALUES LESS THAN (9), + PARTITION p2 VALUES LESS THAN MAXVALUE); +# partition p1 is 't1#P#p1' + @002e * 20 = 107 characters + file ending +# total path lenght of './test/t1#P#p1@002e@002e<...>@002e.MY[ID]' is 118 chars +--echo # List of files in database `test`, all original t1-files here +--list_files $MYSQLD_DATADIR/test t1* +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +--echo # Renaming to a file name where the first partition is 250 chars +--echo # and the second partition is 350 chars +# 7,7 avoids the error message, which is not deterministic. +--error 7,7 +RENAME TABLE t1 TO `t2_new..............................................end`; +# 1234567890123456789012345678901234567890123456 +--echo # List of files in database `test`, should not be any t2-files here +--list_files $MYSQLD_DATADIR/test t2* +--echo # List of files in database `test`, should be all t1-files here +--list_files $MYSQLD_DATADIR/test t1* +--sorted_result +SELECT * FROM t1; +--echo # Renaming to a file name where the first partition is 155 chars +--echo # and the second partition is 255 chars +RENAME TABLE t1 TO `t2_............................end`; +# 1234567890123456789012345678 +# t2_ + end +# .MY[ID] or .frm +# #P#p[012] +# 28 * @002e +# 6 + 4 + 5 + 28 * 5 = 155 +--echo # List of files in database `test`, should not be any t1-files here +--list_files $MYSQLD_DATADIR/test t1* +--echo # List of files in database `test`, should be all t2-files here +--list_files $MYSQLD_DATADIR/test t2* +--sorted_result +SELECT * FROM `t2_............................end`; +RENAME TABLE `t2_............................end` to t1; +--echo # List of files in database `test`, should be all t1-files here +--list_files $MYSQLD_DATADIR/test t1* +--echo # Renaming to a file name where the first partition is 156 chars +--echo # and the second partition is 256 chars +# 7,7 avoids the error message, which is not deterministic. +--error 7,7 +RENAME TABLE t1 TO `t2_............................_end`; +# 1234567890123456789012345678 +# 7 + 4 + 5 + 28 * 5 = 16 + 140 = 156 +--echo # List of files in database `test`, should not be any t2-files here +--list_files $MYSQLD_DATADIR/test t2* +--echo # List of files in database `test`, should be all t1-files here +--list_files $MYSQLD_DATADIR/test t1* +--sorted_result +SELECT * FROM t1; +DROP TABLE t1; +--echo # Should not be any files left here +--list_files $MYSQLD_DATADIR/test t1* +--list_files $MYSQLD_DATADIR/test t2* +--echo # End of bug#30102 test. |