--source include/not_embedded.inc # Check for existence of innobackup and set up environment for it. --source suite/meb/include/have_meb.inc # Enable binary logging --source include/have_log_bin.inc # # Get miscellaneous path names. # LET $BACKUP_LOG = $MYSQLTEST_VARDIR/tmp/backup.log; LET $REPLAY_LOG = $MYSQLTEST_VARDIR/tmp/replay.log; LET $CPBACK_LOG = $MYSQLTEST_VARDIR/tmp/cpback.log; LET MYSQLD_DATADIR = `SELECT @@datadir`; LET BACKUP_TARGET_DIR = $MYSQLTEST_VARDIR/tmp/innobackup; # Precautionary clean up. # --disable_warnings DROP TABLE IF EXISTS mysql.ibbackup_binlog_marker; --enable_warnings --error 0,1 --remove_file $MYSQLD_DATADIR/mysql/ibbackup_binlog_marker.frm --exec perl suite/meb/include/rmtree.pl $BACKUP_TARGET_DIR --echo -------------------------------------------------------------- --echo # Start creating databases and tables # Enable InnoDB storage engine using have_innodb.inc --source include/have_innodb.inc CREATE DATABASE dbb; CREATE TABLE dbb.td1(id INT)ENGINE=INNODB; INSERT INTO dbb.td1 VALUES (1),(2),(3),(4),(5); CREATE TABLE dbb.td2(a CHAR(10))ENGINE=MyISAM; INSERT INTO dbb.td2 VALUES('a'),('b'),('c'),('d'); CREATE TABLE dbb.td3(id INT, a CHAR(5))ENGINE=INNODB; INSERT INTO dbb.td3 VALUES(1,'a'),(2,'b'),(3,'c'),(4,'e'); CREATE TABLE dbb.te1(id INT)ENGINE=INNODB; INSERT INTO dbb.te1 VALUES(1),(2),(3),(4); CREATE TABLE dbb.te2(a CHAR(5))ENGINE=INNODB; CREATE TABLE dbb.tf1(a VARCHAR(10), id INT)ENGINE=INNODB; INSERT INTO dbb.tf1 VALUES('a',10),('b',20); --echo --echo # TEST 1: Test --include regexp option of innobackup --echo SHOW TABLES FROM dbb; SELECT COUNT(*) FROM dbb.td1; SELECT COUNT(*) FROM dbb.td2; SELECT COUNT(*) FROM dbb.td3; --echo # Start backup to backup only tables starting from 'td' --echo # Running innobackup ... --echo # ... --exec $INNOBACKUP --include='dbb\.td.*' --no-timestamp $SERVER_CNF $BACKUP_TARGET_DIR --port=$MASTER_MYPORT --user=root > $BACKUP_LOG 2>&1 # If not success, mysqltest would exit after the --exec line. --echo # Innobackup is Success! # Perform recovery by applying logs --exec $INNOBACKUP --apply-log $SERVER_CNF $BACKUP_TARGET_DIR > $REPLAY_LOG 2>&1 # Now drop the databases and then perform recovery DROP DATABASE dbb; # Now shutdown the server. --source suite/meb/include/stop_mysqld.inc --echo # Clear datadir. --exec perl suite/meb/include/rmtree.pl $MYSQLD_DATADIR --mkdir $MYSQLD_DATADIR # Now do --innobackup --copy-back --exec $INNOBACKUP --copy-back $SERVER_CNF $BACKUP_TARGET_DIR > $CPBACK_LOG 2>&1 # Restart server. --source suite/meb/include/restart_mysqld.inc # After restore verify that databases and tables are restored SHOW DATABASES; SHOW TABLES FROM dbb; SELECT COUNT(*) FROM dbb.td1; SELECT COUNT(*) FROM dbb.td2; SELECT COUNT(*) FROM dbb.td3; --error ER_NO_SUCH_TABLE SELECT COUNT(*) FROM dbb.te1; --error ER_NO_SUCH_TABLE SELECT COUNT(*) FROM dbb.tf1; --echo # Clean up DROP DATABASE dbb; --exec perl suite/meb/include/rmtree.pl $BACKUP_TARGET_DIR --error 0,1 --remove_file $MYSQLD_DATADIR/mysql/ibbackup_binlog_marker.frm --remove_file $BACKUP_LOG --remove_file $REPLAY_LOG --remove_file $CPBACK_LOG --disable_query_log call mtr.add_suppression("InnoDB: Error: table 'db.*"); call mtr.add_suppression("InnoDB: Error: trying to open a table, but could not"); call mtr.add_suppression("MySQL is trying to open a table handle but the .ibd file for"); call mtr.add_suppression("InnoDB: Error: table 'mysql/ibbackup_binlog_marker'"); --enable_query_log