--source include/not_embedded.inc # Check for existence of innobackup and set up environment for it. --source include/have_meb.inc # # Get miscellaneous path names. # LET $BACKUP_LOG = $MYSQL_TMP_DIR/backup.log; LET $REPLAY_LOG = $MYSQL_TMP_DIR/replay.log; LET $CPBACK_LOG = $MYSQL_TMP_DIR/cpback.log; LET MYSQLD_DATADIR = `SELECT @@datadir`; LET BACKUP_TARGET_DIR = $MYSQL_TMP_DIR/innobackup; LET $ENGINE_1 = InnoDB; # Enable InnoDB storage engine using have_innodb.inc --source include/have_innodb.inc --source suite/meb/include/extreme_data.inc --echo --echo # TEST 1 : Perform backup using innobackup script --echo --echo # Perform backup without compression and note down the datafile size --echo # Running innobackup ..... --echo # .... --exec $INNOBACKUP --no-timestamp $SERVER_CNF $BACKUP_TARGET_DIR --socket=$MASTER_MYSOCK --user=root > $BACKUP_LOG # If not success, mysqltest would exit after the --exec line. --echo # Innobackup is Success! --source suite/meb/include/extreme_drop.inc # Perform recovery by applying logs --exec $INNOBACKUP --apply-log $SERVER_CNF $BACKUP_TARGET_DIR > $REPLAY_LOG # Now shutdown the server. --source suite/meb/include/stop_mysqld.inc # Now do --innobackup --copy-back --exec $INNOBACKUP --copy-back $SERVER_CNF $BACKUP_TARGET_DIR > $CPBACK_LOG # Restart server. --source suite/meb/include/restart_mysqld.inc DROP TABLE mysql.ibbackup_binlog_marker; --echo # Clean up for first test --perl use File::Path qw(rmtree); rmtree($ENV{BACKUP_TARGET_DIR}); EOF --remove_file $BACKUP_LOG --remove_file $REPLAY_LOG --remove_file $CPBACK_LOG --echo --echo # TEST 2: Execute backup using ibbackup --echo --echo # Perform backup using ibbackup --echo # starting ibbackup .... --echo # .... --exec $IBBACKUP $SERVER_CNF $BACKUP_CNF > $BACKUP_LOG # If not success, mysqltest would exit after the --exec line. --echo # Success! --echo # Perform ibbackup with apply logs --exec $IBBACKUP --apply-log $BACKUP_CNF > $REPLAY_LOG --echo # Now copy the .frm files from datadir to backupdir --perl use lib "./lib"; # Access MTR perl modules use My::File::Path 'copytree'; copytree($ENV{MYSQLD_DATADIR},$ENV{BACKUP_DIR}); EOF # Shutdown the server --source suite/meb/include/stop_mysqld.inc --echo # Copy back .frm files from backupdir to datadir # First remove the old InnoDB files. --remove_files_wildcard $DATA_DIR ib* # Now copy the restored files in their place. --perl use lib "./lib"; # Access MTR perl modules use My::File::Path 'copytree'; copytree($ENV{BACKUP_DIR},$ENV{MYSQLD_DATADIR}); EOF # Restart the server --source suite/meb/include/restart_mysqld.inc # Check for the databases and tables after restore SHOW DATABASES; # Cleanup for 4th test --source suite/meb/include/extreme_drop.inc --perl use File::Path qw(rmtree); rmtree($ENV{BACKUP_DIR}); EOF --remove_file $BACKUP_LOG --remove_file $REPLAY_LOG