Debian Codegraph @

mysql-test/suite/innodb/t/alter_tablespace_partition.test

raw
1 # needed in sourced show_i_s_tablespaces.inc
2 let $MYSQLD_DATADIR = `select @@datadir`;
3 let $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
4
5 CREATE TABLESPACE s1 ADD DATAFILE 's1.ibd' ENGINE InnoDB;
6
7 # Change tablespace of partitioned table from innodb_file_per_table
8 # to general tablespace
9 CREATE TABLE t1 (col1 INT, col2 INT) ENGINE = InnoDB TABLESPACE innodb_file_per_table PARTITION BY KEY(col1) PARTITIONS 3;
10
11 --source suite/innodb/include/show_i_s_tables.inc
12 --source suite/innodb/include/show_i_s_tablespaces.inc
13
14 ALTER TABLE t1 ENGINE = InnoDB TABLESPACE s1;
15 SHOW CREATE TABLE t1;
16
17 --source suite/innodb/include/show_i_s_tables.inc
18 --source suite/innodb/include/show_i_s_tablespaces.inc
19
20 ALTER TABLE t1 ENGINE = InnoDB TABLESPACE innodb_file_per_table;
21 SHOW CREATE TABLE t1;
22
23 --source suite/innodb/include/show_i_s_tables.inc
24 --source suite/innodb/include/show_i_s_tablespaces.inc
25
26 DROP TABLE t1;
27
28 # Change tablespace of partitioned table from innodb_system
29 # to general tablespace
30 CREATE TABLE t1 (col1 INT, col2 INT) ENGINE = InnoDB TABLESPACE innodb_system PARTITION BY KEY(col1) PARTITIONS 3;
31
32 --source suite/innodb/include/show_i_s_tables.inc
33 --source suite/innodb/include/show_i_s_tablespaces.inc
34
35 ALTER TABLE t1 ENGINE = InnoDB TABLESPACE s1;
36 SHOW CREATE TABLE t1;
37
38 --source suite/innodb/include/show_i_s_tables.inc
39 --source suite/innodb/include/show_i_s_tablespaces.inc
40
41 ALTER TABLE t1 ENGINE = InnoDB TABLESPACE innodb_system;
42 SHOW CREATE TABLE t1;
43
44 --source suite/innodb/include/show_i_s_tables.inc
45 --source suite/innodb/include/show_i_s_tablespaces.inc
46
47 DROP TABLE t1;
48
49 # Change tablespace of partitioned table from general tablespace
50 # to innodb_file_per_table
51 CREATE TABLE t1 (col1 INT, col2 INT) ENGINE = InnoDB TABLESPACE s1 PARTITION BY KEY(col1) PARTITIONS 3;
52
53 --source suite/innodb/include/show_i_s_tables.inc
54 --source suite/innodb/include/show_i_s_tablespaces.inc
55
56 ALTER TABLE t1 ENGINE = InnoDB TABLESPACE innodb_file_per_table;
57 SHOW CREATE TABLE t1;
58
59 --source suite/innodb/include/show_i_s_tables.inc
60 --source suite/innodb/include/show_i_s_tablespaces.inc
61
62 ALTER TABLE t1 ENGINE = InnoDB TABLESPACE s1;
63 SHOW CREATE TABLE t1;
64
65 --source suite/innodb/include/show_i_s_tables.inc
66 --source suite/innodb/include/show_i_s_tablespaces.inc
67
68 DROP TABLE t1;
69
70 # Change tablespace of partitioned table from general tablespace
71 # to innodb_system
72 CREATE TABLE t1 (col1 INT, col2 INT) ENGINE = InnoDB TABLESPACE s1 PARTITION BY KEY(col1) PARTITIONS 3;
73
74 --source suite/innodb/include/show_i_s_tables.inc
75 --source suite/innodb/include/show_i_s_tablespaces.inc
76
77 ALTER TABLE t1 ENGINE = InnoDB TABLESPACE innodb_system;
78 SHOW CREATE TABLE t1;
79
80 --source suite/innodb/include/show_i_s_tables.inc
81 --source suite/innodb/include/show_i_s_tablespaces.inc
82
83 ALTER TABLE t1 ENGINE = InnoDB TABLESPACE s1;
84 SHOW CREATE TABLE t1;
85
86 --source suite/innodb/include/show_i_s_tables.inc
87 --source suite/innodb/include/show_i_s_tablespaces.inc
88
89 DROP TABLE t1;
90
91 DROP TABLESPACE s1;
92
93
94 --echo #
95 --echo # Check if tablespace id of general tablespace or system tablespace
96 --echo # are set properly
97 --echo #
98
99 CREATE TABLESPACE gt1 ADD DATAFILE '1.ibd' FILE_BLOCK_SIZE = 16k ENGINE = InnoDB;
100 CREATE TABLE t1 (col1 INT) ENGINE = InnoDB TABLESPACE gt1;
101
102 ALTER TABLE t1 ENGINE = InnoDB PARTITION BY RANGE(col1 * 2)
103 ( PARTITION p3 VALUES LESS THAN MAXVALUE );
104
105 SHOW CREATE TABLE t1;
106
107 ALTER TABLE t1 ENGINE = InnoDB TABLESPACE innodb_system;
108
109 SHOW CREATE TABLE t1;
110
111 TRUNCATE TABLE t1;
112
113 SHOW CREATE TABLE t1;
114
115 ALTER TABLE t1 ENGINE = InnoDB TABLESPACE gt1;
116
117 SHOW CREATE TABLE t1;
118
119 DROP TABLE t1;
120 DROP TABLESPACE gt1;