File: partition_rename_longfilename.test

package info (click to toggle)
mariadb-10.5 1%3A10.5.23-0%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 712,240 kB
  • sloc: ansic: 2,158,658; cpp: 1,843,101; asm: 297,745; perl: 59,967; sh: 53,869; pascal: 38,348; java: 33,919; yacc: 19,639; python: 11,119; xml: 10,126; sql: 10,027; ruby: 8,544; makefile: 6,343; cs: 2,866; lex: 1,205; javascript: 1,037; objc: 80; tcl: 73; awk: 46; php: 22; sed: 16
file content (51 lines) | stat: -rw-r--r-- 2,112 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
-- source include/not_windows.inc
-- source include/support_long_file_names.inc
-- 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
# This test case renames the table such that the partition file name 
# is 255 chars long. Due the restriction of 260 char path name (including drive label)
# this will fail in windows.
# Other tests related to this bug can be found in partition_not_embedded.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 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*
--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.