File: innodb-import-lctn_1.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (241 lines) | stat: -rw-r--r-- 7,078 bytes parent folder | download
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
--source include/have_debug.inc
--source include/no_valgrind_without_big.inc
--source include/not_windows.inc

let MYSQLD_DATADIR =`SELECT @@datadir`;

--echo #
--echo # Bug #29627690	NOT ABLE TO IMPORT PARTITIONED TABLESPACE OLDER THAN 8.0.14
--echo # After wl#13352, we no longer try to induce 8.0.14 behaviour by debug
--echo # variable. innodb.partition_upgrade* tests checks import from 8.0.14.
--echo # Keeping this test to run on current version.

select @@lower_case_table_names;

--echo # Test 1: With Hash partitions
CREATE TABLE t1 (c1 INT) ENGINE = InnoDB
PARTITION BY HASH (c1) PARTITIONS 3;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6);
SELECT c1 FROM t1 ORDER BY c1;
FLUSH TABLES t1 FOR EXPORT;
perl;
require 'include/innodb-util.inc';
ib_backup_tablespaces("test", "t1#p#p0", "t1#p#p1", "t1#p#p2");
EOF

UNLOCK TABLES;
DROP TABLE t1;

CREATE TABLE t1 (c1 INT) ENGINE = InnoDB
PARTITION BY HASH (c1) PARTITIONS 3;

ALTER TABLE t1 DISCARD TABLESPACE;

perl;
require 'include/innodb-util.inc';
ib_restore_tablespaces("test", "t1#p#p0", "t1#p#p1" , "t1#p#p2");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
SELECT * FROM t1 ORDER BY c1;
DROP TABLE t1;


--echo # Test 2 With range partitions/subpartitions with mixed cases partiton names

create table t1 (f1 int ,f2 int) partition by range (f1)
subpartition by key (f2)
(
partition ABCdef values less than (10) (
subpartition SUB_ABCdef0,
subpartition SUB_abcdef1
),
partition ABC values less than (50) (
subpartition SUB_ABC0,
subpartition SUB_abc1
) ,
partition def values less than (100) (
subpartition sub_def0,
subpartition SUB_DEF1
));
insert into t1 values (90,10) ,(40,78) ,(5,76);
SELECT * from t1 order by f1;
FLUSH TABLES t1 FOR EXPORT;

perl;
require 'include/innodb-util.inc';
ib_backup_tablespaces("test", "t1#p#abcdef#sp#sub_abcdef0", "t1#p#abcdef#sp#sub_abcdef1"
		     , "t1#p#abc#sp#sub_abc0", "t1#p#abc#sp#sub_abc1",
                     ,  "t1#p#def#sp#sub_def0", "t1#p#def#sp#sub_def1");
EOF
unlock tables;
drop table t1;

create table t1 (f1 int ,f2 int) partition by range (f1)
subpartition by key (f2)
(
partition ABCdef values less than (10) (
subpartition SUB_ABCdef0,
subpartition SUB_abcdef1
),
partition ABC values less than (50) (
subpartition SUB_ABC0,
subpartition SUB_abc1
) ,
partition def values less than (100) (
subpartition sub_def0,
subpartition SUB_DEF1
));

ALTER TABLE t1 DISCARD TABLESPACE;
perl;
require 'include/innodb-util.inc';
ib_restore_tablespaces("test", "t1#p#abcdef#sp#sub_abcdef0", "t1#p#abcdef#sp#sub_abcdef1"
		     , "t1#p#abc#sp#sub_abc0", "t1#p#abc#sp#sub_abc1",
                     ,  "t1#p#def#sp#sub_def0", "t1#p#def#sp#sub_def1");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
SELECT * FROM t1 ORDER BY f1;
DROP TABLE t1;


--echo # Test 3 : With encryption

# restart with keying
let $restart_parameters = restart: --early-plugin-load="keyring_file=$KEYRING_PLUGIN" --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR $KEYRING_PLUGIN_OPT --plugin-dir=KEYRING_PLUGIN_PATH $KEYRING_PLUGIN keyring_file.so
--replace_regex /\.dll/.so/
--source include/restart_mysqld.inc

CREATE TABLE t1 (c1 INT) ENGINE = InnoDB ENCRYPTION='Y'
PARTITION BY RANGE (c1) ( PARTITION ABC VALUES LESS THAN (10));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6);
SELECT c1 FROM t1 ORDER BY c1;
FLUSH TABLES t1 FOR EXPORT;

perl;
require 'include/innodb-util.inc';
ib_backup_tablespaces("test", "t1#p#abc");
ib_backup_cfp_file("test", "t1#p#abc");
EOF

UNLOCK TABLES;
DROP TABLE t1;

CREATE TABLE t1 (c1 INT) ENGINE = InnoDB ENCRYPTION='Y'
PARTITION BY RANGE (c1) ( PARTITION ABC VALUES LESS THAN (10));
ALTER TABLE t1 DISCARD TABLESPACE;

perl;
require 'include/innodb-util.inc';
ib_restore_tablespaces("test", "t1#p#abc");
ib_restore_cfp_file("test", "t1#p#abc");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
SELECT * FROM t1 ORDER BY c1;
DROP TABLE t1;

--echo # Restarting server without keyring to restore server state
let $restart_parameters = restart: ;
--source include/restart_mysqld.inc

--echo Test 4 : Missing cfg file

CREATE TABLE t1 (c1 INT) ENGINE = InnoDB
PARTITION BY RANGE (c1) ( PARTITION ABCD VALUES LESS THAN (10));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(8);
SELECT c1 FROM t1 ORDER BY c1;
FLUSH TABLES t1 FOR EXPORT;

perl;
require 'include/innodb-util.inc';
ib_backup_ibd_file("test", "t1#p#abcd");
EOF

UNLOCK TABLES;
DROP TABLE t1;

CREATE TABLE t1 (c1 INT) ENGINE = InnoDB
PARTITION BY RANGE (c1) ( PARTITION ABCD VALUES LESS THAN (10));
ALTER TABLE t1 DISCARD TABLESPACE;

perl;
require 'include/innodb-util.inc';
ib_restore_ibd_files("test", "t1#p#abcd");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
SELECT * FROM t1 ORDER BY c1;
DROP TABLE t1;

--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*.ibd
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*.cfg
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*.cfp

--echo Test 5:-
--echo # 1. Create table in 8.0.13 version
--echo # 2. Upgrade the table to 8.0.15 version
--echo # 3. Add another partition (PART_two)
--echo # 4. Do flush table and generate cfg files
--echo # 5. These ibd and cfg files are present in 8.0.15_cfg.zip
--echo # 6. Do import from the cfg file and ibd from 8.0.15_cfg.zip.

CREATE DATABASE db1;
use db1;
CREATE TABLE t1 (
  f1 int
) ENGINE=InnoDB
PARTITION BY RANGE (f1)
(PARTITION PART_one VALUES LESS THAN (10),
 PARTITION PART_two VALUES LESS THAN (20));
ALTER TABLE t1 DISCARD TABLESPACE;

--let $MYSQLD_DATADIR=`SELECT @@datadir`
--copy_file $MYSQLTEST_VARDIR/std_data/8.0.15_cfg.zip $MYSQL_TMP_DIR/8.0.15_cfg.zip
--exec unzip -qo $MYSQL_TMP_DIR/8.0.15_cfg.zip -d $MYSQLD_DATADIR/db1
--remove_file $MYSQL_TMP_DIR/8.0.15_cfg.zip

ALTER TABLE t1 IMPORT TABLESPACE;
SELECT * from t1 ORDER BY f1;
ALTER TABLE t1 FORCE;
SELECT * from t1 ORDER BY f1;
DROP TABLE t1;
--remove_files_wildcard $MYSQLD_DATADIR/db1 t1*.cfg


--echo Test 6:-
--echo # 1. Create table in 8.0.13 version
--echo # 2. Upgrade the table to 8.0.15 version
--echo # 3. Add another partition (PART_two)
--echo # 4. Upgrade to 8.0.17 versiosn
--echo # 5. Add another partition (PART_three)
--echo # 6. Do flush table and generate cfg files
--echo # 7. These ibd and cfg files are present in 8.0.17_cfg.zip
--echo # 6. Do import from the cfg file and ibd from 8.0.17_cfg.zip

use db1;
CREATE TABLE t1 (
  f1 int
) ENGINE=InnoDB
PARTITION BY RANGE (f1)
(PARTITION PART_one VALUES LESS THAN (10),
 PARTITION PART_two VALUES LESS THAN (20),
 PARTITION PART_three VALUES LESS THAN (30));

ALTER TABLE t1 DISCARD TABLESPACE;

--let $MYSQLD_DATADIR=`SELECT @@datadir`
--copy_file $MYSQLTEST_VARDIR/std_data/8.0.17_cfg.zip $MYSQL_TMP_DIR/8.0.17_cfg.zip
--exec unzip -qo $MYSQL_TMP_DIR/8.0.17_cfg.zip -d $MYSQLD_DATADIR/db1
--remove_file $MYSQL_TMP_DIR/8.0.17_cfg.zip

ALTER TABLE t1 IMPORT TABLESPACE;
SELECT * from t1 ORDER BY f1;
ALTER TABLE t1 FORCE;
SELECT * from t1 ORDER BY f1;

DROP TABLE t1;
--remove_files_wildcard $MYSQLD_DATADIR/db1 t1*.cfg
--remove_files_wildcard $MYSQLD_DATADIR/db1 *.zip
--remove_file $MYSQL_TMP_DIR/mysecret_keyring

DROP DATABASE db1;