mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
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.
This commit is contained in:
107
mysql-test/r/partition_not_embedded.result
Normal file
107
mysql-test/r/partition_not_embedded.result
Normal file
@ -0,0 +1,107 @@
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
# 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);
|
||||
# List of files in database `test`, all original t1-files here
|
||||
t1#P#p0.MYD
|
||||
t1#P#p0.MYI
|
||||
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
|
||||
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
|
||||
t1#P#p2.MYD
|
||||
t1#P#p2.MYI
|
||||
t1.frm
|
||||
t1.par
|
||||
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||
# Renaming to a file name where the first partition is 250 chars
|
||||
# and the second partition is 350 chars
|
||||
RENAME TABLE t1 TO `t2_new..............................................end`;
|
||||
Got one of the listed errors
|
||||
# List of files in database `test`, should not be any t2-files here
|
||||
# List of files in database `test`, should be all t1-files here
|
||||
t1#P#p0.MYD
|
||||
t1#P#p0.MYI
|
||||
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
|
||||
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
|
||||
t1#P#p2.MYD
|
||||
t1#P#p2.MYI
|
||||
t1.frm
|
||||
t1.par
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
10
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
# Renaming to a file name where the first partition is 155 chars
|
||||
# and the second partition is 255 chars
|
||||
RENAME TABLE t1 TO `t2_............................end`;
|
||||
# List of files in database `test`, should not be any t1-files here
|
||||
# List of files in database `test`, should be all t2-files here
|
||||
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend#P#p0.MYD
|
||||
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend#P#p0.MYI
|
||||
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
|
||||
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
|
||||
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend#P#p2.MYD
|
||||
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend#P#p2.MYI
|
||||
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend.frm
|
||||
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend.par
|
||||
SELECT * FROM `t2_............................end`;
|
||||
a
|
||||
1
|
||||
10
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
RENAME TABLE `t2_............................end` to t1;
|
||||
# List of files in database `test`, should be all t1-files here
|
||||
t1#P#p0.MYD
|
||||
t1#P#p0.MYI
|
||||
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
|
||||
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
|
||||
t1#P#p2.MYD
|
||||
t1#P#p2.MYI
|
||||
t1.frm
|
||||
t1.par
|
||||
# Renaming to a file name where the first partition is 156 chars
|
||||
# and the second partition is 256 chars
|
||||
RENAME TABLE t1 TO `t2_............................_end`;
|
||||
Got one of the listed errors
|
||||
# List of files in database `test`, should not be any t2-files here
|
||||
# List of files in database `test`, should be all t1-files here
|
||||
t1#P#p0.MYD
|
||||
t1#P#p0.MYI
|
||||
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
|
||||
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
|
||||
t1#P#p2.MYD
|
||||
t1#P#p2.MYI
|
||||
t1.frm
|
||||
t1.par
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
10
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
DROP TABLE t1;
|
||||
# Should not be any files left here
|
||||
# End of bug#30102 test.
|
Reference in New Issue
Block a user