Current Path : /usr/opt/mysql57/mysql-test/suite/innodb/r/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/mysql57/mysql-test/suite/innodb/r/innodb-multiple-tablespaces.result |
SET default_storage_engine=InnoDB; # # Test when tablespaces can be found at multiple places # SYS_DATAFILES will refer to the file at alt_dir. # Link File will refer to the file at new_dir. # Tablename Default SYS_DATAFILES Link_File # yyy Yes Yes Yes # nyy No Yes Yes # yny Yes No Yes # yyn Yes Yes No # nyw No Yes WrongFile # nwy No WrongFile Yes # wny WrongFile No Yes # ynw Yes No WrongFile # wyn WrongFile Yes No # ywn Yes WrongFile No # nnn No No No # www WrongFile WrongFile WrongFile # nolink No Yes, No ISL No # CREATE TABLE yyy (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO yyy VALUES (1, 'yyy'); CREATE TABLE nyy (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO nyy VALUES (1, 'nyy'); CREATE TABLE yny (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO yny VALUES (1, 'yny'); CREATE TABLE yyn (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO yyn VALUES (1, 'yyn'); CREATE TABLE nyw (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO nyw VALUES (1, 'nyw'); CREATE TABLE nwy (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO nwy VALUES (1, 'nwy'); CREATE TABLE wny (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO wny VALUES (1, 'wny'); CREATE TABLE ynw (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO ynw VALUES (1, 'ynw'); CREATE TABLE wyn (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO wyn VALUES (1, 'wyn'); CREATE TABLE ywn (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO ywn VALUES (1, 'ywn'); CREATE TABLE nnn (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO nnn VALUES (1, 'nnn'); CREATE TABLE www (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO www VALUES (1, 'www'); CREATE TABLE nolink (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO nolink VALUES (1, 'no link file'); # # Shutdown the server, copy and remove files. # ---- MYSQLD_DATADIR/test nnn.frm nnn.isl nolink.frm nolink.isl nwy.frm nwy.isl nyw.frm nyw.isl nyy.frm nyy.isl wny.frm wny.isl www.frm www.isl wyn.frm wyn.isl ynw.frm ynw.isl yny.frm yny.isl ywn.frm ywn.isl yyn.frm yyn.isl yyy.frm yyy.isl ---- MYSQL_TMP_DIR/alt_dir/test nnn.ibd nolink.ibd nwy.ibd nyw.ibd nyy.ibd wny.ibd www.ibd wyn.ibd ynw.ibd yny.ibd ywn.ibd yyn.ibd yyy.ibd ---- MYSQL_TMP_DIR/new_dir/test # YYY; Tablespace found in 3 places # NYY; Tablespace found in alt_dir and new_dir # YNY; Tablespace found in default and new_dir # YYN; Tablespace found in default and alt_dir # NYW; Copy the wrong file to new_dir # NWY; Move the wrong file to alt_dir, good one to new_dir. # WNY; Move the wrong file to default, good one to new_dir, delete it form alt_dir # YNW; Move the file to default, wrong one to new_dir, delete it form alt_dir # WYN; Copy the wrong file to default # YWN; Move the file to default, wrong one to alt_dir # NNN; Delete the tablespace and ISL # WWW; Put the wrong file in all three locations # NOLINK; Delete the ISL file Since remote location is still in SYS_DATAFILES, # it should still be found. And the ISL file should be re-created. # Make a backup of this tablespace to use later. ---- MYSQLD_DATADIR/test nnn.frm nolink.frm nwy.frm nwy.isl nyw.frm nyw.isl nyy.frm nyy.isl wny.frm wny.ibd wny.isl www.frm www.ibd www.isl wyn.frm wyn.ibd wyn.isl ynw.frm ynw.ibd ynw.isl yny.frm yny.ibd yny.isl ywn.frm ywn.ibd ywn.isl yyn.frm yyn.ibd yyn.isl yyy.frm yyy.ibd yyy.isl ---- MYSQL_TMP_DIR/alt_dir/test nolink.ibd nolink.ibd.bak nwy.ibd nyw.ibd nyy.ibd www.ibd wyn.ibd ywn.ibd yyn.ibd yyy.ibd ---- MYSQL_TMP_DIR/new_dir/test nwy.ibd nyw.ibd nyy.ibd wny.ibd www.ibd ynw.ibd yny.ibd yyy.ibd # # Start the server and show the tablespaces. # # restart === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path test/yyy Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/yyy.ibd test/nyy Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/nyy.ibd test/yny Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/yny.ibd test/yyn Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/yyn.ibd test/nyw Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/nyw.ibd test/nwy Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/new_dir/test/nwy.ibd test/wny Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/new_dir/test/wny.ibd test/ynw Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/ynw.ibd test/wyn Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/wyn.ibd test/ywn Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/ywn.ibd test/nnn Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/nnn.ibd test/www Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/www.ibd test/nolink Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/nolink.ibd === information_schema.files === Space_Name File_Type Engine Status Tablespace_Name Path test/nyw TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/nyw.ibd test/nwy TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/new_dir/test/nwy.ibd test/wny TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/new_dir/test/wny.ibd test/ynw TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/ynw.ibd test/wyn TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/wyn.ibd test/ywn TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/ywn.ibd test/nolink TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/nolink.ibd SELECT * FROM yyy; ERROR HY000: Tablespace is missing for table `test`.`yyy`. SELECT * FROM nyy; ERROR HY000: Tablespace is missing for table `test`.`nyy`. SELECT * FROM yny; ERROR HY000: Tablespace is missing for table `test`.`yny`. SELECT * FROM yyn; ERROR HY000: Tablespace is missing for table `test`.`yyn`. SELECT * FROM nyw; c1 c2 1 nyw SELECT * FROM nwy; c1 c2 1 nwy SELECT * FROM wny; c1 c2 1 wny SELECT * FROM ynw; c1 c2 1 ynw SELECT * FROM wyn; c1 c2 1 wyn SELECT * FROM ywn; c1 c2 1 ywn SELECT * FROM nnn; ERROR HY000: Tablespace is missing for table `test`.`nnn`. SELECT * FROM www; ERROR HY000: Tablespace is missing for table `test`.`www`. SELECT * FROM nolink; c1 c2 1 no link file SHOW CREATE TABLE yyy; ERROR HY000: Tablespace is missing for table `test`.`yyy`. SHOW CREATE TABLE nyy; ERROR HY000: Tablespace is missing for table `test`.`nyy`. SHOW CREATE TABLE yny; ERROR HY000: Tablespace is missing for table `test`.`yny`. SHOW CREATE TABLE yyn; ERROR HY000: Tablespace is missing for table `test`.`yyn`. SHOW CREATE TABLE nyw; Table Create Table nyw CREATE TABLE `nyw` ( `c1` int(11) NOT NULL, `c2` text, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SHOW CREATE TABLE nwy; Table Create Table nwy CREATE TABLE `nwy` ( `c1` int(11) NOT NULL, `c2` text, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/new_dir/' SHOW CREATE TABLE wny; Table Create Table wny CREATE TABLE `wny` ( `c1` int(11) NOT NULL, `c2` text, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/new_dir/' SHOW CREATE TABLE ynw; Table Create Table ynw CREATE TABLE `ynw` ( `c1` int(11) NOT NULL, `c2` text, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SHOW CREATE TABLE wyn; Table Create Table wyn CREATE TABLE `wyn` ( `c1` int(11) NOT NULL, `c2` text, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SHOW CREATE TABLE ywn; Table Create Table ywn CREATE TABLE `ywn` ( `c1` int(11) NOT NULL, `c2` text, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SHOW CREATE TABLE nnn; ERROR HY000: Tablespace is missing for table `test`.`nnn`. SHOW CREATE TABLE www; ERROR HY000: Tablespace is missing for table `test`.`www`. SHOW CREATE TABLE nolink; Table Create Table nolink CREATE TABLE `nolink` ( `c1` int(11) NOT NULL, `c2` text, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' # # List of files before DROP TABLES # ---- MYSQLD_DATADIR/test nnn.frm nolink.frm nolink.isl nwy.frm nwy.isl nyw.frm nyw.isl nyy.frm nyy.isl wny.frm wny.ibd wny.isl www.frm www.ibd www.isl wyn.frm wyn.ibd wyn.isl ynw.frm ynw.ibd yny.frm yny.ibd yny.isl ywn.frm ywn.ibd yyn.frm yyn.ibd yyn.isl yyy.frm yyy.ibd yyy.isl ---- MYSQL_TMP_DIR/alt_dir/test nolink.ibd nolink.ibd.bak nwy.ibd nyw.ibd nyy.ibd www.ibd wyn.ibd ywn.ibd yyn.ibd yyy.ibd ---- MYSQL_TMP_DIR/new_dir/test nwy.ibd nyw.ibd nyy.ibd wny.ibd www.ibd ynw.ibd yny.ibd yyy.ibd # # Restart the server and DROP the tablespaces. # # restart DROP TABLE yyy; DROP TABLE nyy; DROP TABLE yny; DROP TABLE yyn; DROP TABLE nyw; DROP TABLE nwy; DROP TABLE wny; DROP TABLE ynw; DROP TABLE wyn; DROP TABLE ywn; DROP TABLE nnn; DROP TABLE www; DROP TABLE nolink; # # List of files not deleted by the DROP TABLES # ---- MYSQLD_DATADIR/test wny.ibd www.ibd wyn.ibd yny.ibd yyn.ibd yyy.ibd ---- MYSQL_TMP_DIR/alt_dir/test nolink.ibd.bak nwy.ibd nyy.ibd www.ibd ywn.ibd yyn.ibd yyy.ibd ---- MYSQL_TMP_DIR/new_dir/test nyw.ibd nyy.ibd www.ibd ynw.ibd yny.ibd yyy.ibd # # List of files after removing leftover files # ---- MYSQLD_DATADIR/test ---- MYSQL_TMP_DIR/alt_dir/test nolink.ibd.bak ---- MYSQL_TMP_DIR/new_dir/test # # Create some tables again and this time, crash instead of shutdown # InnoDB recovery uses MLOG_FILE_records in the REDO log to find the # previous location of a tablespace since the dictionary is not # available. During recovery InnoDB will choose a file from multiple # locations based on this priority; # 1. Default location: # General Tablespace = datadir # File-per-table = datadir/dbname # 2. ISL location: if the ISL file exists. # 3. REDO log record location from MLOG_FILE_NAME record. # # Test recovery when tablespaces can be found at multiple places. # In each case except the control tablespace, the ISL file will # exist with a file name in alt_dir. 'fnolink.ibd.bak' is the # source of the 'wrong' tablespaces. # # Tablename Default_Tablespace Remote_Tablespace # ny No Yes # wy Wrong Yes # yn Yes No # yw Yes Wrong # yy Yes Yes (both the same file) # CREATE TABLE ny (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO ny VALUES (1, 'ny'); CREATE TABLE wy (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO wy VALUES (1, 'wy'); CREATE TABLE yn (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO yn VALUES (1, 'yn'); CREATE TABLE yw (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO yw VALUES (1, 'yw'); CREATE TABLE yy (c1 INT KEY, c2 TEXT) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO yy VALUES (1, 'yy'); # # Crash the server, copy and remove files. # BEGIN; INSERT INTO ny VALUES (2, 'ny'); INSERT INTO wy VALUES (2, 'wy'); INSERT INTO yn VALUES (2, 'yn'); INSERT INTO yw VALUES (2, 'yw'); INSERT INTO yy VALUES (2, 'yy'); SELECT * FROM ny; c1 c2 1 ny 2 ny SELECT * FROM wy; c1 c2 1 wy 2 wy SELECT * FROM yn; c1 c2 1 yn 2 yn SELECT * FROM yw; c1 c2 1 yw 2 yw SELECT * FROM yy; c1 c2 1 yy 2 yy # Kill the server # # Now that the engine is not running, move files around to test various scenarios. # # NY; Tablespace found in alt_dir but not the default directory. # WY; The wrong tablespace is found in the default directory # and the correct one in alt_dir. # YW; Tablespace is found in the default directory but the wrong file in alt_dir. # YN; Tablespace found the default directory but not in alt_dir. # YY; Found in both default directory and alt-dir. ---- MYSQLD_DATADIR/test ny.frm ny.isl wy.frm wy.ibd wy.isl yn.frm yn.ibd yn.isl yw.frm yw.ibd yw.isl yy.frm yy.ibd yy.isl ---- MYSQL_TMP_DIR/alt_dir/test nolink.ibd.bak ny.ibd wy.ibd yw.ibd yy.ibd # restoring yn.ibd, yw.ibd # restart SELECT * FROM ny; c1 c2 1 ny SELECT * FROM wy; c1 c2 1 wy SELECT * FROM yn; c1 c2 1 yn SELECT * FROM yw; c1 c2 1 yw SELECT * FROM yy; c1 c2 1 yy SHOW CREATE TABLE ny; Table Create Table ny CREATE TABLE `ny` ( `c1` int(11) NOT NULL, `c2` text, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SHOW CREATE TABLE wy; Table Create Table wy CREATE TABLE `wy` ( `c1` int(11) NOT NULL, `c2` text, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SHOW CREATE TABLE yn; Table Create Table yn CREATE TABLE `yn` ( `c1` int(11) NOT NULL, `c2` text, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SHOW CREATE TABLE yw; Table Create Table yw CREATE TABLE `yw` ( `c1` int(11) NOT NULL, `c2` text, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SHOW CREATE TABLE yy; Table Create Table yy CREATE TABLE `yy` ( `c1` int(11) NOT NULL, `c2` text, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path test/ny Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/ny.ibd test/wy Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/wy.ibd test/yn Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/yn.ibd test/yw Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/yw.ibd test/yy Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/yy.ibd === information_schema.files === Space_Name File_Type Engine Status Tablespace_Name Path test/ny TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/ny.ibd test/wy TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/wy.ibd test/yn TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/yn.ibd test/yw TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/yw.ibd test/yy TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/yy.ibd # # List of files before removing unused files # DROP TABLE ny; DROP TABLE wy; DROP TABLE yn; DROP TABLE yw; DROP TABLE yy; # # List of files after DROP TABLES # ---- MYSQLD_DATADIR/test wy.ibd ---- MYSQL_TMP_DIR/alt_dir/test nolink.ibd.bak yy.ibd