config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/innodb/t/

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
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/suite/innodb/t/log_file_name.test

# WL#7142 InnoDB: Simplify tablespace discovery during crash recovery
# Test the detection of duplicate tablespaces.

--source include/have_innodb.inc
--source include/have_innodb_max_16k.inc

# Embedded server does not support crashing
--source include/not_embedded.inc

SET GLOBAL innodb_file_per_table=ON;

CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;

--source include/no_checkpoint_start.inc
CREATE TABLE t3(a INT PRIMARY KEY) ENGINE=InnoDB;

BEGIN;
INSERT INTO t3 VALUES (33101),(347);
INSERT INTO t1 VALUES (42),(9),(101);
RENAME TABLE t1 TO t2;
UPDATE t2 SET a=347 where a=42;
COMMIT;

--let CLEANUP_IF_CHECKPOINT=DROP TABLE t2,t3;
--source include/no_checkpoint_end.inc

--echo # Fault 0 (no real fault): Orphan file with duplicate space_id.
--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t0.ibd

--echo # Fault 1: Two dirty files with the same space_id.
--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t1.ibd

let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
let $mysqld=$MYSQLD_CMD --core-file --console > $SEARCH_FILE 2>&1;

# This could fail to refuse startup, in case there was a log
# checkpoint after the INSERT. That is what we checked above.
--error 1,42
--exec $mysqld

let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t2.ibd' with space ID \d+. Another data file called .*t1.ibd exists with the same space ID;
--source include/search_pattern_in_file.inc

--remove_file $MYSQLD_DATADIR/test/t1.ibd
--remove_file $SEARCH_FILE

# This could fail to refuse startup, in case there was a log
# checkpoint after the CREATE TABLE t3. That is what we checked above.
--echo # Fault 2: Wrong space_id in a dirty file, and a missing file.
--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t1.ibd

--error 3,42
--exec $mysqld

let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t1.ibd' with space ID;
--source include/search_pattern_in_file.inc

let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at.*t3.ibd;
--source include/search_pattern_in_file.inc

--move_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t3.ibd
--remove_file $SEARCH_FILE

--echo # Fault 3: Wrong space_id in a dirty file, and no missing file.
# Swap t2.ibd and t3.ibd.
--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t.ibd
--move_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t3.ibd
--move_file $MYSQLD_DATADIR/test/t.ibd $MYSQLD_DATADIR/test/t2.ibd

--error 3,42
--exec $mysqld

let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t[23].ibd' with space ID;
--source include/search_pattern_in_file.inc

let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t1.ibd;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t3.ibd;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace;
--source include/search_pattern_in_file.inc

# Swap back t3.ibd, but hide t2.ibd (which the redo log also knows as t1.ibd).
--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t.ibd
--move_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t3.ibd

--remove_file $SEARCH_FILE

--echo # Fault 4: Missing data file

--error 3,42
--exec $mysqld

let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd.
.*InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace;
--source include/search_pattern_in_file.inc

--remove_file $SEARCH_FILE

--echo # Fault 5: Wrong type of data file

# TODO: Test the following as well once
# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES
# has been fixed:
#  A file containing 16384 zero bytes.
#  --mkdir $MYSQLD_DATADIR/test/t2.ibd

# Create a short file.
--exec echo "" > $MYSQLD_DATADIR/test/t2.ibd

--error 3,42
--exec $mysqld

let SEARCH_PATTERN= \[ERROR\] InnoDB: Datafile .*t2.*\. Cannot determine the space ID from the first 64 pages;
--source include/search_pattern_in_file.inc

--remove_file $SEARCH_FILE

# Restore t2.ibd
--remove_file $MYSQLD_DATADIR/test/t2.ibd
--move_file $MYSQLD_DATADIR/test/t.ibd $MYSQLD_DATADIR/test/t2.ibd

--source include/start_mysqld.inc

SELECT * FROM t2;
SELECT * FROM t3;
SHOW TABLES;
DROP TABLE t2,t3;

--error ER_TABLESPACE_EXISTS
CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;

# Remove the orphan file from fault 0.
--remove_file $MYSQLD_DATADIR/test/t0.ibd

CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
DROP TABLE t0;

--disable_query_log
# The following are for the orphan file t0.ibd:
call mtr.add_suppression("InnoDB: Operating system error number [0-9]* in a file operation");
call mtr.add_suppression("InnoDB: Error number [0-9]* means 'File exists'");
call mtr.add_suppression("InnoDB: Cannot create file '.*t0.ibd'");
call mtr.add_suppression("InnoDB: The file '.*t0\.ibd' already exists");
# The following are for the --innodb-force-recovery=1 with broken u* tables:
call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified");
call mtr.add_suppression("InnoDB: .*you must create directories");
call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: '.*u[1-5]\.ibd'");
call mtr.add_suppression("InnoDB: Could not find a valid tablespace file for `test/u[1-5]`");
call mtr.add_suppression("InnoDB: Tablespace open failed for .test.\..u[1-5]., ignored");
call mtr.add_suppression("InnoDB: Ignoring tablespace `test/u[1-3]` because it could not be opened.");
call mtr.add_suppression("InnoDB: Failed to find tablespace for table .* in the cache. Attempting to load the tablespace with space id");
--enable_query_log

--source include/no_checkpoint_start.inc

CREATE TABLE u1(a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE u2(a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE u3(a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE u4(a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO u4 VALUES(1);
RENAME TABLE u4 TO u5;
RENAME TABLE u5 TO u6;
INSERT INTO u6 VALUES(2);

--let CLEANUP_IF_CHECKPOINT=DROP TABLE u1,u2,u3,u6;
--source include/no_checkpoint_end.inc

--echo # Fault 6: All-zero data file and innodb_force_recovery

--remove_file $MYSQLD_DATADIR/test/u1.ibd
--remove_file $MYSQLD_DATADIR/test/u2.ibd
--remove_file $MYSQLD_DATADIR/test/u3.ibd

# InnoDB: Header page consists of zero bytes
perl;
die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/test/u1.ibd");
print FILE "\0" x 16384;
close(FILE);
EOF

--exec echo "" > $MYSQLD_DATADIR/test/u2.ibd

# TODO: Test with this, once
# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES
# has been fixed:
#--mkdir $MYSQLD_DATADIR/test/u3.ibd

--copy_file $MYSQLD_DATADIR/test/u6.ibd $MYSQLD_DATADIR/test/u4.ibd

--error 1,42
--exec $mysqld --innodb-force-recovery=1

let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd;
--source include/search_pattern_in_file.inc

let SEARCH_PATTERN= \[ERROR\] InnoDB: Datafile .*u1.*\. Cannot determine the space ID from the first 64 pages;
--source include/search_pattern_in_file.inc

# TODO: These errors should state the file name (u2.ibd) and be ignored
# in innodb-force-recovery mode once
# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES
# has been fixed:
let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*u2.ibd.*;
--source include/search_pattern_in_file.inc

--remove_file $SEARCH_FILE

# Allow --innodb-force-recovery to start despite the broken file.
# TODO: Remove this workaround, and make --innodb-force-recovery=1
# ignore the broken file.
--remove_file $MYSQLD_DATADIR/test/u2.ibd

--echo # Fault 7: Missing or wrong data file and innodb_force_recovery

--error 1,42
--exec $mysqld --innodb-force-recovery=1

let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd;
--source include/search_pattern_in_file.inc

let SEARCH_PATTERN= InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace;
--source include/search_pattern_in_file.inc

let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot rename '.*u5.ibd' to '.*u6.ibd' for space ID \d+ because the target file exists;
--source include/search_pattern_in_file.inc

--remove_file $MYSQLD_DATADIR/test/u6.ibd

--error 1,42
--exec $mysqld --innodb-force-recovery=1 --innodb-nonexistent-option
let SEARCH_PATTERN= \[ERROR\] unknown option '--innodb-nonexistent-option';
--source include/search_pattern_in_file.inc

let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd;
--source include/search_pattern_in_file.inc

let SEARCH_PATTERN= InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace;
--source include/search_pattern_in_file.inc

let SEARCH_PATTERN= \[Warning\] InnoDB: Tablespace \d+ was not found at .*u[1-5].ibd, and innodb_force_recovery was set. All redo log for this tablespace will be ignored!;
--source include/search_pattern_in_file.inc

--remove_file $SEARCH_FILE

# Avoid assertion failure on DROP TABLE due to all-zero file
# TODO: Fix this and remove the workaround, maybe as part of
# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES

--remove_file $MYSQLD_DATADIR/test/u1.ibd

--source include/start_mysqld.inc

DROP TABLE u1,u2,u3,u6;

--echo # List of files:
--list_files $MYSQLD_DATADIR/test

SHOW TABLES;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE NAME NOT LIKE 'SYS_%' AND NAME NOT LIKE 'mysql/%';

Man Man