1#
2# These test make sure that tables are visible after rebooting
3#
4
5--source include/have_innodb.inc
6
7# Embedded server does not support crashing
8--source include/not_embedded.inc
9
10# Avoid CrashReporter popup on Mac
11#--source include/not_crashrep.inc
12
13SET default_storage_engine=InnoDB;
14
15--disable_query_log
16LET $MYSQLD_DATADIR = `select @@datadir`;
17LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
18LET $data_directory = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
19--enable_query_log
20
21--mkdir $MYSQL_TMP_DIR/alt_dir
22--mkdir $MYSQL_TMP_DIR/alt_dir/test
23--mkdir $MYSQL_TMP_DIR/new_dir
24--mkdir $MYSQL_TMP_DIR/new_dir/test
25
26--disable_query_log
27# These errors are expected in the error log for this test.
28call mtr.add_suppression("\\[ERROR\\] InnoDB: A tablespace for `test/.*` has been found in multiple places");
29call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot open datafile for read-only:");
30call mtr.add_suppression("\\[ERROR\\] InnoDB: Could not find a valid tablespace file for ");
31call mtr.add_suppression("\\[ERROR\\] InnoDB: Default location:");
32call mtr.add_suppression("\\[ERROR\\] InnoDB: Dictionary location:");
33call mtr.add_suppression("\\[ERROR\\] InnoDB: Error number 11 means 'Resource temporarily unavailable'");
34call mtr.add_suppression("\\[ERROR\\] InnoDB: Error number 35 means 'Resource temporarily unavailable'");
35call mtr.add_suppression("\\[ERROR\\] InnoDB: Error number 38 means 'Function not implemented'.");
36call mtr.add_suppression("\\[ERROR\\] InnoDB: Failed to find tablespace for table `test`.`.*` in the cache. Attempting to load");
37call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.");
38call mtr.add_suppression("\\[ERROR\\] InnoDB: In file '.*', tablespace id and flags are .* but in the InnoDB data dictionary they are");
39call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number 2 in a file operation.");
40call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number 11 in a file operation.");
41call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number 35 in a file operation.");
42call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number 38 in a file operation.");
43call mtr.add_suppression("\\[ERROR\\] InnoDB: Remote location:");
44call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified.");
45call mtr.add_suppression("\\[ERROR\\] InnoDB: Will not open tablespace `test/.*`");
46call mtr.add_suppression("\\[Warning\\] InnoDB: Cannot calculate statistics for table `test`\.`.*` because the \.ibd file is missing");
47call mtr.add_suppression("\\[Warning\\] InnoDB: Ignoring tablespace `test/.*` because it could not be opened.");
48--enable_query_log
49
50--echo #
51--echo # Test when tablespaces can be found at multiple places
52--echo # SYS_DATAFILES will refer to the file at alt_dir.
53--echo # Link File will refer to the file at new_dir.
54--echo #  Tablename   Default   SYS_DATAFILES    Link_File
55--echo #      yyy       Yes          Yes            Yes
56--echo #      nyy       No           Yes            Yes
57--echo #      yny       Yes          No             Yes
58--echo #      yyn       Yes          Yes            No
59--echo #      nyw       No           Yes            WrongFile
60--echo #      nwy       No           WrongFile      Yes
61--echo #      wny       WrongFile    No             Yes
62--echo #      ynw       Yes          No             WrongFile
63--echo #      wyn       WrongFile    Yes            No
64--echo #      ywn       Yes          WrongFile      No
65--echo #      nnn       No           No             No
66--echo #      www       WrongFile    WrongFile      WrongFile
67--echo #   nolink       No           Yes, No ISL    No
68--echo #
69
70--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
71eval CREATE TABLE yyy (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
72INSERT INTO yyy VALUES (1, 'yyy');
73
74--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
75eval CREATE TABLE nyy (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
76INSERT INTO nyy VALUES (1, 'nyy');
77
78--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
79eval CREATE TABLE yny (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
80INSERT INTO yny VALUES (1, 'yny');
81
82--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
83eval CREATE TABLE yyn (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
84INSERT INTO yyn VALUES (1, 'yyn');
85
86--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
87eval CREATE TABLE nyw (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
88INSERT INTO nyw VALUES (1, 'nyw');
89
90--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
91eval CREATE TABLE nwy (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
92INSERT INTO nwy VALUES (1, 'nwy');
93
94--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
95eval CREATE TABLE wny (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
96INSERT INTO wny VALUES (1, 'wny');
97
98--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
99eval CREATE TABLE ynw (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
100INSERT INTO ynw VALUES (1, 'ynw');
101
102--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
103eval CREATE TABLE wyn (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
104INSERT INTO wyn VALUES (1, 'wyn');
105
106--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
107eval CREATE TABLE ywn (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
108INSERT INTO ywn VALUES (1, 'ywn');
109
110--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
111eval CREATE TABLE nnn (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
112INSERT INTO nnn VALUES (1, 'nnn');
113
114--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
115eval CREATE TABLE www (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
116INSERT INTO www VALUES (1, 'www');
117
118--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
119eval CREATE TABLE nolink (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
120INSERT INTO nolink VALUES (1, 'no link file');
121
122--echo #
123--echo # Shutdown the server, copy and remove files.
124--echo #
125--source include/shutdown_mysqld.inc
126
127--echo ---- MYSQLD_DATADIR/test
128--list_files $MYSQLD_DATADIR/test
129--echo ---- MYSQL_TMP_DIR/alt_dir/test
130--list_files $MYSQL_TMP_DIR/alt_dir/test
131--echo ---- MYSQL_TMP_DIR/new_dir/test
132--list_files $MYSQL_TMP_DIR/new_dir/test
133
134--echo # YYY; Tablespace found in 3 places
135--copy_file $MYSQL_TMP_DIR/alt_dir/test/yyy.ibd $MYSQLD_DATADIR/test/yyy.ibd
136--copy_file $MYSQL_TMP_DIR/alt_dir/test/yyy.ibd $MYSQL_TMP_DIR/new_dir/test/yyy.ibd
137--exec echo $MYSQL_TMP_DIR/new_dir/test/yyy.ibd > $MYSQLD_DATADIR/test/yyy.isl
138
139--echo # NYY; Tablespace found in alt_dir and new_dir
140--copy_file $MYSQL_TMP_DIR/alt_dir/test/nyy.ibd $MYSQL_TMP_DIR/new_dir/test/nyy.ibd
141--exec echo $MYSQL_TMP_DIR/new_dir/test/nyy.ibd > $MYSQLD_DATADIR/test/nyy.isl
142
143--echo # YNY; Tablespace found in default and new_dir
144--copy_file $MYSQL_TMP_DIR/alt_dir/test/yny.ibd $MYSQLD_DATADIR/test/yny.ibd
145--move_file $MYSQL_TMP_DIR/alt_dir/test/yny.ibd $MYSQL_TMP_DIR/new_dir/test/yny.ibd
146--exec echo $MYSQL_TMP_DIR/new_dir/test/yny.ibd > $MYSQLD_DATADIR/test/yny.isl
147
148--echo # YYN; Tablespace found in default and alt_dir
149--copy_file $MYSQL_TMP_DIR/alt_dir/test/yyn.ibd $MYSQLD_DATADIR/test/yyn.ibd
150
151--echo # NYW; Copy the wrong file to new_dir
152--copy_file $MYSQL_TMP_DIR/alt_dir/test/yyy.ibd $MYSQL_TMP_DIR/new_dir/test/nyw.ibd
153--exec echo $MYSQL_TMP_DIR/new_dir/test/nyw.ibd > $MYSQLD_DATADIR/test/nyw.isl
154
155--echo # NWY; Move the wrong file to alt_dir, good one to new_dir.
156--move_file $MYSQL_TMP_DIR/alt_dir/test/nwy.ibd $MYSQL_TMP_DIR/new_dir/test/nwy.ibd
157--exec echo $MYSQL_TMP_DIR/new_dir/test/nwy.ibd > $MYSQLD_DATADIR/test/nwy.isl
158--copy_file $MYSQL_TMP_DIR/alt_dir/test/yyy.ibd $MYSQL_TMP_DIR/alt_dir/test/nwy.ibd
159
160--echo # WNY; Move the wrong file to default, good one to new_dir, delete it form alt_dir
161--copy_file $MYSQL_TMP_DIR/alt_dir/test/yyy.ibd $MYSQLD_DATADIR/test/wny.ibd
162--move_file $MYSQL_TMP_DIR/alt_dir/test/wny.ibd $MYSQL_TMP_DIR/new_dir/test/wny.ibd
163--exec echo $MYSQL_TMP_DIR/new_dir/test/wny.ibd > $MYSQLD_DATADIR/test/wny.isl
164
165--echo # YNW; Move the file to default, wrong one to new_dir, delete it form alt_dir
166--copy_file $MYSQL_TMP_DIR/alt_dir/test/ynw.ibd $MYSQLD_DATADIR/test/ynw.ibd
167--remove_file $MYSQL_TMP_DIR/alt_dir/test/ynw.ibd
168--copy_file $MYSQL_TMP_DIR/alt_dir/test/yyy.ibd $MYSQL_TMP_DIR/new_dir/test/ynw.ibd
169--exec echo $MYSQL_TMP_DIR/new_dir/test/ynw.ibd > $MYSQLD_DATADIR/test/ynw.isl
170
171--echo # WYN; Copy the wrong file to default
172--copy_file $MYSQL_TMP_DIR/alt_dir/test/yyy.ibd $MYSQLD_DATADIR/test/wyn.ibd
173
174--echo # YWN; Move the file to default, wrong one to alt_dir
175--copy_file $MYSQL_TMP_DIR/alt_dir/test/ywn.ibd $MYSQLD_DATADIR/test/ywn.ibd
176-- remove_file $MYSQL_TMP_DIR/alt_dir/test/ywn.ibd
177--copy_file $MYSQL_TMP_DIR/alt_dir/test/yyy.ibd $MYSQL_TMP_DIR/alt_dir/test/ywn.ibd
178
179--echo # NNN; Delete the tablespace and ISL
180--remove_file $MYSQLD_DATADIR/test/nnn.isl
181--remove_file $MYSQL_TMP_DIR/alt_dir/test/nnn.ibd
182
183--echo # WWW; Put the wrong file in all three locations
184--copy_file $MYSQL_TMP_DIR/alt_dir/test/yyy.ibd $MYSQLD_DATADIR/test/www.ibd
185--remove_file $MYSQL_TMP_DIR/alt_dir/test/www.ibd
186--copy_file $MYSQL_TMP_DIR/alt_dir/test/yyy.ibd $MYSQL_TMP_DIR/alt_dir/test/www.ibd
187--copy_file $MYSQL_TMP_DIR/alt_dir/test/yyy.ibd $MYSQL_TMP_DIR/new_dir/test/www.ibd
188--exec echo $MYSQL_TMP_DIR/new_dir/test/www.ibd > $MYSQLD_DATADIR/test/www.isl
189
190--echo # NOLINK; Delete the ISL file Since remote location is still in SYS_DATAFILES,
191--echo # it should still be found. And the ISL file should be re-created.
192--remove_file $MYSQLD_DATADIR/test/nolink.isl
193
194--echo # Make a backup of this tablespace to use later.
195--copy_file $MYSQL_TMP_DIR/alt_dir/test/nolink.ibd $MYSQL_TMP_DIR/alt_dir/test/nolink.ibd.bak
196
197--echo ---- MYSQLD_DATADIR/test
198--list_files $MYSQLD_DATADIR/test
199--echo ---- MYSQL_TMP_DIR/alt_dir/test
200--list_files $MYSQL_TMP_DIR/alt_dir/test
201--echo ---- MYSQL_TMP_DIR/new_dir/test
202--list_files $MYSQL_TMP_DIR/new_dir/test
203
204--echo #
205--echo # Start the server and show the tablespaces.
206--echo #
207--source include/start_mysqld.inc
208
209--source suite/innodb/include/show_i_s_tablespaces.inc
210
211--error ER_TABLESPACE_MISSING
212SELECT * FROM yyy;
213--error ER_TABLESPACE_MISSING
214SELECT * FROM nyy;
215--error ER_TABLESPACE_MISSING
216SELECT * FROM yny;
217--error ER_TABLESPACE_MISSING
218SELECT * FROM yyn;
219SELECT * FROM nyw;
220SELECT * FROM nwy;
221SELECT * FROM wny;
222SELECT * FROM ynw;
223SELECT * FROM wyn;
224SELECT * FROM ywn;
225--error ER_TABLESPACE_MISSING
226SELECT * FROM nnn;
227--error ER_TABLESPACE_MISSING
228SELECT * FROM www;
229SELECT * FROM nolink;
230
231--error ER_TABLESPACE_MISSING
232SHOW CREATE TABLE yyy;
233--error ER_TABLESPACE_MISSING
234SHOW CREATE TABLE nyy;
235--error ER_TABLESPACE_MISSING
236SHOW CREATE TABLE yny;
237--error ER_TABLESPACE_MISSING
238SHOW CREATE TABLE yyn;
239--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
240SHOW CREATE TABLE nyw;
241--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
242SHOW CREATE TABLE nwy;
243--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
244SHOW CREATE TABLE wny;
245SHOW CREATE TABLE ynw;
246--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
247SHOW CREATE TABLE wyn;
248SHOW CREATE TABLE ywn;
249--error ER_TABLESPACE_MISSING
250SHOW CREATE TABLE nnn;
251--error ER_TABLESPACE_MISSING
252SHOW CREATE TABLE www;
253--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
254SHOW CREATE TABLE nolink;
255
256--echo #
257--echo # List of files before DROP TABLES
258--echo #
259--echo ---- MYSQLD_DATADIR/test
260--list_files $MYSQLD_DATADIR/test
261--echo ---- MYSQL_TMP_DIR/alt_dir/test
262--list_files $MYSQL_TMP_DIR/alt_dir/test
263--echo ---- MYSQL_TMP_DIR/new_dir/test
264--list_files $MYSQL_TMP_DIR/new_dir/test
265
266--echo #
267--echo # Restart the server and DROP the tablespaces.
268--echo #
269--source include/restart_mysqld.inc
270
271DROP TABLE yyy;
272DROP TABLE nyy;
273DROP TABLE yny;
274DROP TABLE yyn;
275DROP TABLE nyw;
276DROP TABLE nwy;
277DROP TABLE wny;
278DROP TABLE ynw;
279DROP TABLE wyn;
280DROP TABLE ywn;
281DROP TABLE nnn;
282DROP TABLE www;
283DROP TABLE nolink;
284
285--echo #
286--echo # List of files not deleted by the DROP TABLES
287--echo #
288--echo ---- MYSQLD_DATADIR/test
289--list_files $MYSQLD_DATADIR/test
290--echo ---- MYSQL_TMP_DIR/alt_dir/test
291--list_files $MYSQL_TMP_DIR/alt_dir/test
292--echo ---- MYSQL_TMP_DIR/new_dir/test
293--list_files $MYSQL_TMP_DIR/new_dir/test
294
295--remove_file $MYSQLD_DATADIR/test/www.ibd
296--remove_file $MYSQLD_DATADIR/test/wny.ibd
297--remove_file $MYSQLD_DATADIR/test/wyn.ibd
298--remove_file $MYSQLD_DATADIR/test/yny.ibd
299--remove_file $MYSQLD_DATADIR/test/yyn.ibd
300--remove_file $MYSQLD_DATADIR/test/yyy.ibd
301--remove_file $MYSQL_TMP_DIR/alt_dir/test/nwy.ibd
302--remove_file $MYSQL_TMP_DIR/alt_dir/test/nyy.ibd
303--remove_file $MYSQL_TMP_DIR/alt_dir/test/www.ibd
304--remove_file $MYSQL_TMP_DIR/alt_dir/test/ywn.ibd
305--remove_file $MYSQL_TMP_DIR/alt_dir/test/yyn.ibd
306--remove_file $MYSQL_TMP_DIR/alt_dir/test/yyy.ibd
307--remove_file $MYSQL_TMP_DIR/new_dir/test/nyw.ibd
308--remove_file $MYSQL_TMP_DIR/new_dir/test/nyy.ibd
309--remove_file $MYSQL_TMP_DIR/new_dir/test/www.ibd
310--remove_file $MYSQL_TMP_DIR/new_dir/test/ynw.ibd
311--remove_file $MYSQL_TMP_DIR/new_dir/test/yny.ibd
312--remove_file $MYSQL_TMP_DIR/new_dir/test/yyy.ibd
313
314--echo #
315--echo # List of files after removing leftover files
316--echo #
317--echo ---- MYSQLD_DATADIR/test
318--list_files $MYSQLD_DATADIR/test
319--echo ---- MYSQL_TMP_DIR/alt_dir/test
320--list_files $MYSQL_TMP_DIR/alt_dir/test
321--echo ---- MYSQL_TMP_DIR/new_dir/test
322--list_files $MYSQL_TMP_DIR/new_dir/test
323
324--echo #
325--echo # Create some tables again and this time, crash instead of shutdown
326--echo # InnoDB recovery uses MLOG_FILE_records in the REDO log to find the
327--echo # previous location of a tablespace since the dictionary is not
328--echo # available.  During recovery InnoDB will choose a file from multiple
329--echo # locations based on this priority;
330--echo #    1. Default location:
331--echo #         General Tablespace = datadir
332--echo #         File-per-table = datadir/dbname
333--echo #    2. ISL location: if the ISL file exists.
334--echo #    3. REDO log record location from MLOG_FILE_NAME record.
335--echo #
336--echo # Test recovery when tablespaces can be found at multiple places.
337--echo # In each case except the control tablespace, the ISL file will
338--echo # exist with a file name in alt_dir.  'fnolink.ibd.bak' is the
339--echo # source of the 'wrong' tablespaces.
340--echo #
341--echo # Tablename   Default_Tablespace  Remote_Tablespace
342--echo #    ny              No                  Yes
343--echo #    wy              Wrong               Yes
344--echo #    yn              Yes                 No
345--echo #    yw              Yes                 Wrong
346--echo #    yy              Yes                 Yes  (both the same file)
347--echo #
348
349--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
350eval CREATE TABLE ny (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
351INSERT INTO ny VALUES (1, 'ny');
352
353--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
354eval CREATE TABLE wy (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
355INSERT INTO wy VALUES (1, 'wy');
356
357--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
358eval CREATE TABLE yn (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
359INSERT INTO yn VALUES (1, 'yn');
360
361--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
362eval CREATE TABLE yw (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
363INSERT INTO yw VALUES (1, 'yw');
364
365--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
366eval CREATE TABLE yy (c1 INT KEY, c2 TEXT) ENGINE=InnoDB  $data_directory;
367INSERT INTO yy VALUES (1, 'yy');
368
369--echo #
370--echo # Crash the server, copy and remove files.
371--echo #
372--source include/no_checkpoint_start.inc
373
374BEGIN;
375INSERT INTO ny VALUES (2, 'ny');
376INSERT INTO wy VALUES (2, 'wy');
377INSERT INTO yn VALUES (2, 'yn');
378INSERT INTO yw VALUES (2, 'yw');
379INSERT INTO yy VALUES (2, 'yy');
380
381SELECT * FROM ny;
382SELECT * FROM wy;
383SELECT * FROM yn;
384SELECT * FROM yw;
385SELECT * FROM yy;
386
387--let CLEANUP_IF_CHECKPOINT=drop table ny,wy,yn,yw,yy;
388--let CLEANUP_FILES_IF_CHECKPOINT=--source suite/innodb/include/innodb-multiple-tablespaces-cleanup.inc
389
390#This will kill the server
391--source include/no_checkpoint_end.inc
392
393--echo #
394--echo # Now that the engine is not running, move files around to test various scenarios.
395--echo #
396
397--echo # NY; Tablespace found in alt_dir but not the default directory.
398
399--echo # WY; The wrong tablespace is found in the default directory
400--echo #     and the correct one in alt_dir.
401--copy_file $MYSQL_TMP_DIR/alt_dir/test/nolink.ibd.bak $MYSQLD_DATADIR/test/wy.ibd
402
403--echo # YW; Tablespace is found in the default directory but the wrong file in alt_dir.
404--copy_file $MYSQL_TMP_DIR/alt_dir/test/yw.ibd $MYSQLD_DATADIR/test/yw.ibd
405--remove_file  $MYSQL_TMP_DIR/alt_dir/test/yw.ibd
406--copy_file $MYSQL_TMP_DIR/alt_dir/test/nolink.ibd.bak $MYSQL_TMP_DIR/alt_dir/test/yw.ibd
407
408--echo # YN; Tablespace found the default directory but not in alt_dir.
409--copy_file $MYSQL_TMP_DIR/alt_dir/test/yn.ibd $MYSQLD_DATADIR/test/yn.ibd
410--remove_file $MYSQL_TMP_DIR/alt_dir/test/yn.ibd
411
412--echo # YY; Found in both default directory and alt-dir.
413--copy_file $MYSQL_TMP_DIR/alt_dir/test/yy.ibd $MYSQLD_DATADIR/test/yy.ibd
414
415--echo ---- MYSQLD_DATADIR/test
416--list_files $MYSQLD_DATADIR/test
417--echo ---- MYSQL_TMP_DIR/alt_dir/test
418--list_files $MYSQL_TMP_DIR/alt_dir/test
419
420let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
421let $mysqld=$MYSQLD_CMD --core-file --console > $SEARCH_FILE 2>&1;
422
423--echo # restoring yn.ibd, yw.ibd
424--copy_file $MYSQLD_DATADIR/test/yn.ibd $MYSQL_TMP_DIR/alt_dir/test/yn.ibd
425--remove_file $MYSQLD_DATADIR/test/yn.ibd
426--remove_file  $MYSQL_TMP_DIR/alt_dir/test/yw.ibd
427--copy_file $MYSQLD_DATADIR/test/yw.ibd $MYSQL_TMP_DIR/alt_dir/test/yw.ibd
428--remove_file  $MYSQLD_DATADIR/test/yw.ibd
429
430
431--source include/start_mysqld.inc
432
433SELECT * FROM ny;
434SELECT * FROM wy;
435SELECT * FROM yn;
436SELECT * FROM yw;
437SELECT * FROM yy;
438
439--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
440SHOW CREATE TABLE ny;
441--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
442SHOW CREATE TABLE wy;
443--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
444SHOW CREATE TABLE yn;
445--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
446SHOW CREATE TABLE yw;
447--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
448SHOW CREATE TABLE yy;
449
450--source suite/innodb/include/show_i_s_tablespaces.inc
451
452--echo #
453--echo # List of files before removing unused files
454--echo #
455
456DROP TABLE ny;
457DROP TABLE wy;
458DROP TABLE yn;
459DROP TABLE yw;
460DROP TABLE yy;
461
462--echo #
463--echo # List of files after DROP TABLES
464--echo #
465--echo ---- MYSQLD_DATADIR/test
466--list_files $MYSQLD_DATADIR/test
467--echo ---- MYSQL_TMP_DIR/alt_dir/test
468--list_files $MYSQL_TMP_DIR/alt_dir/test
469
470--remove_file $MYSQLD_DATADIR/test/wy.ibd
471--remove_file $MYSQL_TMP_DIR/alt_dir/test/yy.ibd
472--remove_file $MYSQL_TMP_DIR/alt_dir/test/nolink.ibd.bak
473
474--rmdir $MYSQL_TMP_DIR/alt_dir/test
475--rmdir $MYSQL_TMP_DIR/alt_dir
476--rmdir $MYSQL_TMP_DIR/new_dir/test
477--rmdir $MYSQL_TMP_DIR/new_dir
478