1
-- source include/have_partition.inc
2
-- source include/not_embedded.inc
4
DROP TABLE IF EXISTS t1, t2;
6
let $MYSQLD_DATADIR= `SELECT @@datadir`;
9
# Bug#30102: rename table does corrupt tables with partition files on failure
11
--echo # Bug#30102 test
12
CREATE TABLE t1 (a INT)
13
PARTITION BY RANGE (a)
14
(PARTITION p0 VALUES LESS THAN (6),
15
PARTITION `p1....................` VALUES LESS THAN (9),
16
PARTITION p2 VALUES LESS THAN MAXVALUE);
17
# partition p1 is 't1#P#p1' + @002e * 20 = 107 characters + file ending
18
# total path lenght of './test/t1#P#p1@002e@002e<...>@002e.MY[ID]' is 118 chars
19
--echo # List of files in database `test`, all original t1-files here
20
--list_files $MYSQLD_DATADIR/test t1*
21
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
22
--echo # Renaming to a file name where the first partition is 250 chars
23
--echo # and the second partition is 350 chars
24
# 7,7 avoids the error message, which is not deterministic.
26
RENAME TABLE t1 TO `t2_new..............................................end`;
27
# 1234567890123456789012345678901234567890123456
28
--echo # List of files in database `test`, should not be any t2-files here
29
--list_files $MYSQLD_DATADIR/test t2*
30
--echo # List of files in database `test`, should be all t1-files here
31
--list_files $MYSQLD_DATADIR/test t1*
34
--echo # List of files in database `test`, should be all t1-files here
35
--list_files $MYSQLD_DATADIR/test t1*
36
--echo # Renaming to a file name where the first partition is 156 chars
37
--echo # and the second partition is 256 chars
38
# 7,7 avoids the error message, which is not deterministic.
40
RENAME TABLE t1 TO `t2_............................_end`;
41
# 1234567890123456789012345678
42
# 7 + 4 + 5 + 28 * 5 = 16 + 140 = 156
43
--echo # List of files in database `test`, should not be any t2-files here
44
--list_files $MYSQLD_DATADIR/test t2*
45
--echo # List of files in database `test`, should be all t1-files here
46
--list_files $MYSQLD_DATADIR/test t1*
50
--echo # Should not be any files left here
51
--list_files $MYSQLD_DATADIR/test t1*
52
--list_files $MYSQLD_DATADIR/test t2*
53
--echo # End of bug#30102 test.