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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
|
#
# These test make sure that tables are visible after rebooting
#
--source include/have_innodb.inc
--source include/have_innodb_zip.inc
--source include/have_partition.inc
--source include/not_embedded.inc
SET default_storage_engine=InnoDB;
LET $MYSQLD_DATADIR = `select @@datadir`;
LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
--disable_query_log
# This error is expected in the error log for this test.
call mtr.add_suppression("\\[ERROR\\] InnoDB: Error number 17 means 'File exists'");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number (17|80) in a file operation.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot create file .*t55_restart.isl");
call mtr.add_suppression("\\[ERROR\\] InnoDB: The link file: .* already exists.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot open datafile for read-only:");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number 2 in a file operation.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.");
--enable_query_log
--echo #
--echo # A series of tests to make sure tables are opened after restart.
--echo # Bug#13357607 Compressed file-per-table tablespaces fail to open
--echo #
# This bug was introduced without a regression test failing since
# there were no tests showing that tablespaces could be created and
# then read after reboot.
#
--disable_query_log
let $MYSQL_DATA_DIR= `select @@datadir`;
let $data_directory = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
let $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
--enable_query_log
set global innodb_file_per_table=on;
--echo #
--echo # Create and insert records into a REDUNDANT row formatted table.
--echo #
CREATE TABLE t1_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=REDUNDANT ENGINE=InnoDB;
INSERT INTO t1_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart);
INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart);
INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart);
INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart);
SHOW CREATE TABLE t1_restart;
SELECT count(*) FROM t1_restart;
--echo #
--echo # Create and insert records into a COMPACT row formatted table.
--echo #
CREATE TABLE t2_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=COMPACT ENGINE=InnoDB;
INSERT INTO t2_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
SHOW CREATE TABLE t2_restart;
SELECT count(*) FROM t2_restart;
--echo #
--echo # Create and insert records into a COMPRESSED row formatted table.
--echo #
CREATE TABLE t3_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 ENGINE=InnoDB;
INSERT INTO t3_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart);
INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart);
INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart);
INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart);
SHOW CREATE TABLE t3_restart;
SELECT count(*) FROM t3_restart;
--echo #
--echo # Create and insert records into a DYNAMIC row formatted table.
--echo #
CREATE TABLE t4_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=DYNAMIC ENGINE=InnoDB;
INSERT INTO t4_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
SHOW CREATE TABLE t4_restart;
SELECT count(*) FROM t4_restart;
--echo #
--echo # Create and insert records into a table that uses a remote DATA DIRECTORY.
--echo #
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
eval CREATE TABLE t5_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=DYNAMIC ENGINE=InnoDB $data_directory;
INSERT INTO t5_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t5_restart;
SELECT count(*) FROM t5_restart;
--echo #
--echo # Create and insert records into a partitioned table that uses
--echo # a remote DATA DIRECTORY for each partition.
--echo #
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
eval CREATE TABLE t6_restart(
c1 INT AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 ENGINE=InnoDB
PARTITION BY HASH(c1) (
PARTITION p0 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir',
PARTITION p1 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir',
PARTITION p2 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir');
INSERT INTO t6_restart VALUES (0, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart);
INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart);
INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart);
INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart);
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t6_restart;
SELECT count(*) FROM t6_restart;
--echo #
--echo # Create and insert records into a subpartitioned table that uses
--echo # a remote DATA DIRECTORY for each subpartition.
--echo #
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
eval CREATE TABLE t7_restart(
c1 INT AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=DYNAMIC ENGINE=InnoDB
PARTITION BY RANGE(c1) SUBPARTITION BY HASH(c1) (
PARTITION p0 VALUES LESS THAN (10) (
SUBPARTITION s0 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir',
SUBPARTITION s1 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir'),
PARTITION p1 VALUES LESS THAN MAXVALUE (
SUBPARTITION s2 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir',
SUBPARTITION s3 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir'));
INSERT INTO t7_restart VALUES (0, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart);
INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart);
INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart);
INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart);
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t7_restart;
SELECT count(*) FROM t7_restart;
--echo #
--echo # Create and insert records into a table that uses a general tablespace.
--echo #
CREATE TABLESPACE s1_restart ADD DATAFILE 's1_restart.ibd';
CREATE TABLE t8_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=COMPACT ENGINE=InnoDB TABLESPACE=s1_restart;
INSERT INTO t8_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
SHOW CREATE TABLE t8_restart;
SELECT count(*) FROM t8_restart;
CREATE TABLE t9_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=DYNAMIC ENGINE=InnoDB TABLESPACE=s1_restart;
INSERT INTO t9_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
SHOW CREATE TABLE t9_restart;
SELECT count(*) FROM t9_restart;
--echo #
--echo # Show these tables in information_schema.
--echo #
--source suite/innodb/include/show_i_s_tables.inc
--source suite/innodb/include/show_i_s_tablespaces.inc
--echo #
--echo # Shutdown the server and list the tablespace OS files
--echo #
--source include/shutdown_mysqld.inc
--echo ---- MYSQL_DATA_DIR/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/alt_dir
--list_files $MYSQL_TMP_DIR/alt_dir
--echo ---- MYSQL_TMP_DIR/alt_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/alt_dir/test
--echo #
--echo # Start the server and show that tables are still visible and accessible.
--echo #
--source include/start_mysqld.inc
SHOW VARIABLES LIKE 'innodb_file_per_table';
SHOW CREATE TABLE t1_restart;
SHOW CREATE TABLE t2_restart;
SHOW CREATE TABLE t3_restart;
SHOW CREATE TABLE t4_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t5_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t6_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t7_restart;
SHOW CREATE TABLE t8_restart;
SHOW CREATE TABLE t9_restart;
INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart);
INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart);
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart);
INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart);
INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t8_restart);
INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t9_restart);
SELECT count(*) FROM t1_restart;
SELECT count(*) FROM t2_restart;
SELECT count(*) FROM t3_restart;
SELECT count(*) FROM t4_restart;
SELECT count(*) FROM t5_restart;
SELECT count(*) FROM t6_restart;
SELECT count(*) FROM t7_restart;
SELECT count(*) FROM t8_restart;
SELECT count(*) FROM t9_restart;
--echo #
--echo # Show these tables in information_schema.
--echo #
--source suite/innodb/include/show_i_s_tables.inc
--source suite/innodb/include/show_i_s_tablespaces.inc
DROP TABLE t1_restart;
DROP TABLE t2_restart;
DROP TABLE t3_restart;
# Tablespace for t4_restart will be moved later from default directory to a new directory
# and an ISL file will be created not using InnoDB.
# Table t5_restart will be expanded.
# Tables t6_restart and t7_restart will be truncated.
DROP TABLE t8_restart;
DROP TABLE t9_restart;
DROP TABLESPACE s1_restart;
--echo #
--echo # Truncate the remote tablespaces.
--echo #
TRUNCATE TABLE t5_restart;
ALTER TABLE t6_restart TRUNCATE PARTITION p2;
ALTER TABLE t7_restart TRUNCATE PARTITION p1;
--source suite/innodb/include/show_i_s_tablespaces.inc
INSERT INTO t5_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
SELECT count(*) FROM t5_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t5_restart;
SELECT count(*) FROM t6_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t6_restart;
SELECT count(*) FROM t7_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t7_restart;
--echo #
--echo # Shutdown the server and make a backup of a tablespace
--echo #
--source include/shutdown_mysqld.inc
--copy_file $MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd $MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd.bak
--copy_file $MYSQL_DATA_DIR/test/t5_restart.isl $MYSQL_DATA_DIR/test/t5_restart.isl.bak
--copy_file $MYSQL_DATA_DIR/test/t5_restart.frm $MYSQL_DATA_DIR/test/t5_restart.frm.bak
--echo ---- MYSQL_DATA_DIR/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/alt_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/alt_dir/test
--echo #
--echo # Start the server and show the tablespaces.
--echo #
--source include/start_mysqld.inc
SHOW VARIABLES LIKE 'innodb_file_per_table';
--source suite/innodb/include/show_i_s_tablespaces.inc
SELECT count(*) FROM t5_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t5_restart;
SELECT count(*) FROM t6_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t6_restart;
SELECT count(*) FROM t7_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t7_restart;
--echo #
--echo # Try to rename a tablespace to a file that already exists
--echo #
--copy_file $MYSQL_DATA_DIR/test/t5_restart.frm.bak $MYSQL_DATA_DIR/test/t55_restart.frm
--error ER_TABLE_EXISTS_ERROR
RENAME TABLE t5_restart TO t55_restart;
--remove_file $MYSQL_DATA_DIR/test/t55_restart.frm
--remove_file $MYSQL_DATA_DIR/test/t5_restart.frm.bak
--copy_file $MYSQL_DATA_DIR/test/t5_restart.isl.bak $MYSQL_DATA_DIR/test/t55_restart.isl
--error ER_ERROR_ON_RENAME
RENAME TABLE t5_restart TO t55_restart;
--remove_file $MYSQL_DATA_DIR/test/t55_restart.isl
--remove_file $MYSQL_DATA_DIR/test/t5_restart.isl.bak
#--copy_file $MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd.bak $MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
# This RENAME TABLE works of Linux but gets ER_ERROR_ON_RENAME on Windows
#--error ER_ERROR_ON_RENAME
#RENAME TABLE t5_restart TO t55_restart;
#--remove_file $MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
--remove_file $MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd.bak
--echo ---- MYSQL_DATA_DIR/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/alt_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/alt_dir/test
--echo #
--echo # Rename file table and tablespace
--echo #
RENAME TABLE t5_restart TO t55_restart;
RENAME TABLE t6_restart TO t66_restart;
RENAME TABLE t7_restart TO t77_restart;
--source suite/innodb/include/show_i_s_tablespaces.inc
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
SELECT count(*) FROM t55_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t55_restart;
INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart);
SELECT count(*) FROM t66_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t66_restart;
INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart);
SELECT count(*) FROM t77_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t77_restart;
--echo ---- MYSQL_DATA_DIR/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/alt_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/alt_dir/test
--echo #
--echo # Restart the server
--echo #
--source include/restart_mysqld.inc
SHOW VARIABLES LIKE 'innodb_file_per_table';
--source suite/innodb/include/show_i_s_tablespaces.inc
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
SELECT count(*) FROM t55_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t55_restart;
INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart);
SELECT count(*) FROM t66_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t66_restart;
INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart);
SELECT count(*) FROM t77_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t77_restart;
--echo #
--echo # Shutdown the server
--echo #
--source include/shutdown_mysqld.inc
--echo #
--echo # Move the remote tablespaces to a new location and change the ISL files
--echo #
--mkdir $MYSQL_TMP_DIR/new_dir
--mkdir $MYSQL_TMP_DIR/new_dir/test
--echo ---- MYSQL_DATA_DIR/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/alt_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/alt_dir/test
--echo ---- MYSQL_TMP_DIR/new_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/new_dir/test
--echo # Moving tablespace 't4_restart' from MYSQL_DATA_DIR to MYSQL_TMP_DIR/new_dir
--copy_file $MYSQL_DATA_DIR/test/t4_restart.ibd $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd
--remove_file $MYSQL_DATA_DIR/test/t4_restart.ibd
--exec echo $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd > $MYSQL_DATA_DIR/test/t4_restart.isl
--echo # Moving tablespace 't55_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
--copy_file $MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd
--remove_file $MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
--remove_file $MYSQL_DATA_DIR/test/t55_restart.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd > $MYSQL_DATA_DIR/test/t55_restart.isl
--echo # Moving tablespace 't66_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
--copy_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p0.ibd $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd
--copy_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p1.ibd $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p1.ibd
--copy_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p2.ibd $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p2.ibd
--remove_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p0.ibd
--remove_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p1.ibd
--remove_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p2.ibd
--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p0.isl
--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p1.isl
--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p2.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd > $MYSQL_DATA_DIR/test/t66_restart#P#p0.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p1.ibd > $MYSQL_DATA_DIR/test/t66_restart#P#p1.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p2.ibd > $MYSQL_DATA_DIR/test/t66_restart#P#p2.isl
--echo # Moving tablespace 't77_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
--copy_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p0#SP#s0.ibd $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd
--copy_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p0#SP#s1.ibd $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s1.ibd
--copy_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p1#SP#s2.ibd $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s2.ibd
--copy_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p1#SP#s3.ibd $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s3.ibd
--remove_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p0#SP#s0.ibd
--remove_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p0#SP#s1.ibd
--remove_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p1#SP#s2.ibd
--remove_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p1#SP#s3.ibd
--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s0.isl
--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.isl
--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.isl
--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s0.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s1.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s2.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s3.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl
--echo ---- MYSQL_DATA_DIR/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/alt_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/alt_dir/test
--echo ---- MYSQL_TMP_DIR/new_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/new_dir/test
--echo #
--echo # Start the server and check tablespaces.
--echo #
--source include/start_mysqld.inc
--source suite/innodb/include/show_i_s_tablespaces.inc
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
SELECT count(*) FROM t4_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t4_restart;
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
SELECT count(*) FROM t55_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t55_restart;
INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart);
SELECT count(*) FROM t66_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t66_restart;
INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart);
SELECT count(*) FROM t77_restart;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t77_restart;
--echo #
--echo # Shutdown the server
--echo #
--source include/shutdown_mysqld.inc
--echo #
--echo # Move the remote tablespaces back to the default datadir and delete the ISL file.
--echo #
--echo ---- MYSQL_DATA_DIR/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/new_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/new_dir/test
--echo # Moving 't4_restart' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
--copy_file $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd $MYSQL_DATA_DIR/test/t4_restart.ibd
--remove_file $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd
--remove_file $MYSQL_DATA_DIR/test/t4_restart.isl
--echo # Moving 't55_restart' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
--copy_file $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd $MYSQL_DATA_DIR/test/t55_restart.ibd
--remove_file $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd
--remove_file $MYSQL_DATA_DIR/test/t55_restart.isl
--echo # Moving 't66_restart' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
--copy_file $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd $MYSQL_DATA_DIR/test/t66_restart#P#p0.ibd
--copy_file $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p1.ibd $MYSQL_DATA_DIR/test/t66_restart#P#p1.ibd
--copy_file $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p2.ibd $MYSQL_DATA_DIR/test/t66_restart#P#p2.ibd
--remove_file $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd
--remove_file $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p1.ibd
--remove_file $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p2.ibd
--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p0.isl
--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p1.isl
--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p2.isl
--echo # Moving 't77_restart' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
--copy_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s0.ibd
--copy_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s1.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.ibd
--copy_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s2.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.ibd
--copy_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s3.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.ibd
--remove_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd
--remove_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s1.ibd
--remove_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s2.ibd
--remove_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s3.ibd
--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s0.isl
--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.isl
--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.isl
--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl
--echo ---- MYSQL_DATA_DIR/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/new_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/new_dir/test
--echo #
--echo # Start the server and check tablespaces.
--echo #
-- source include/start_mysqld.inc
--source suite/innodb/include/show_i_s_tablespaces.inc
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
SELECT count(*) FROM t4_restart;
SHOW CREATE TABLE t4_restart;
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
SELECT count(*) FROM t55_restart;
SHOW CREATE TABLE t55_restart;
INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart);
SELECT count(*) FROM t66_restart;
SHOW CREATE TABLE t66_restart;
INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart);
SELECT count(*) FROM t77_restart;
SHOW CREATE TABLE t77_restart;
--echo #
--echo # Cleanup
--echo #
DROP TABLE t4_restart;
DROP TABLE t55_restart;
DROP TABLE t66_restart;
DROP TABLE t77_restart;
--rmdir $MYSQL_TMP_DIR/alt_dir/test
--rmdir $MYSQL_TMP_DIR/alt_dir
--rmdir $MYSQL_TMP_DIR/new_dir/test
--rmdir $MYSQL_TMP_DIR/new_dir
-- disable_query_log
eval set global innodb_file_per_table=$innodb_file_per_table_orig;
-- enable_query_log
|