List:Commits« Previous MessageNext Message »
From:Rafal Somla Date:May 4 2010 12:05pm
Subject:bzr commit into mysql-5.1 branch (Rafal.Somla:3450)
View as plain text  
#At file:///ext/mysql/bzr/mysql-5.1-meb-testing/ based on revid:ingo.struewing@stripped

 3450 Rafal Somla	2010-05-04
      Common infrastructure for testing MEB tools.
      
      This patch contains infrastructure for invoking
      MEB tools from test scripts.
     @ mysql-test/include/have_meb.inc
        File to be included by meb tests. Test will be skipped if
        IBBACKUP or INNOBACKUP variables are not set, will fail if
        they do not point at the tools. Also setups backup directory
        and config file for ibbackup tool.
        
        NOTE: PATH setting is temporary and needs to be reworked.
     @ mysql-test/suite/meb/my.cnf
        Configuration for server instance used in meb
        tests. Innodb options used by MEB tools are 
        explicitly set because these tools do not know
        the details. Relevant settings are also exported to
        the environment.
     @ mysql-test/suite/meb/t/ibb_example.test
        Example showing how to use ibbackup tool in a test.
     @ mysql-test/suite/meb/t/inb_example.test
        Example showing how to use innobackup in a test.

    added:
      mysql-test/include/have_meb.inc
      mysql-test/suite/meb/my.cnf
      mysql-test/suite/meb/t/ibb_example.test
      mysql-test/suite/meb/t/inb_example.test
=== added file 'mysql-test/include/have_meb.inc'
--- a/mysql-test/include/have_meb.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/have_meb.inc	2010-05-04 12:05:12 +0000
@@ -0,0 +1,52 @@
+--disable_query_log
+
+# Check that we have MEB setup
+
+if (`select '$IBBACKUP'='' OR '$INNOBACKUP'=''`)
+{
+--skip You must set IBBACKUP and INNOBACKUP variables to run this test.
+}
+
+--enable_query_log
+
+--perl
+if (! -x "$ENV{'IBBACKUP'}")
+{
+  die "Can't find ibbackup tool at \"$ENV{'IBBACKUP'}\"\n";
+}
+if (! -f "$ENV{'INNOBACKUP'}")
+{
+  die "Can't find innobackup tool at \"$ENV{'INNOBACKUP'}\"\n";
+}
+EOF
+
+let $INNOBACKUP= perl -w $INNOBACKUP --ibbackup=$IBBACKUP;
+let $SERVER_CNF= $MYSQLTEST_VARDIR/my.cnf;
+let BACKUP_DIR=  $TMP_DIR/backup;
+let BACKUP_CNF= $TMP_DIR/ib.cnf;
+
+# FIXME: make it portable (windows) and work also in binary distribution
+# where clients are placed in a different path.
+#
+let PATH=../client:$PATH;
+
+--perl
+
+$backup_dir= "$ENV{BACKUP_DIR}";
+
+unless (-d $backup_dir)
+{
+  mkdir($backup_dir) or die "Can't create backup directory \"$backup_dir\"\n";
+}
+
+open (CNF, ">$ENV{BACKUP_CNF}") or die "Can't write to \"$ENV{BACKUP_CNF}\"\n";
+
+print CNF "datadir= $backup_dir\n";
+print CNF "innodb_data_home_dir= $backup_dir\n";
+print CNF "innodb_log_group_home_dir= $backup_dir\n";
+print CNF "innodb_data_file_path= $ENV{IDATA_PATH}\n";
+print CNF "innodb_log_files_in_group= $ENV{ILOG_COUNT}\n";
+print CNF "innodb_log_file_size= $ENV{ILOG_SIZE}\n";
+
+close CNF;
+EOF

=== added file 'mysql-test/suite/meb/my.cnf'
--- a/mysql-test/suite/meb/my.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/meb/my.cnf	2010-05-04 12:05:12 +0000
@@ -0,0 +1,31 @@
+# Use defaults
+!include include/default_my.cnf
+
+[mysqld]
+#
+# Note: it is important to use loose-innodb_data_file_path option
+# because only this overwrites the defaults.
+#
+loose-innodb_data_file_path= ibdata1:10M;ibdata2:10M:autoextend
+innodb_log_file_size= 5M
+innodb_log_files_in_group= 3
+innodb= on
+#
+# Note: these parameters must be set here in the [mysqld] section
+# so that the innobackup script can read them.
+#
+datadir=                   @mysqld.1.datadir
+innodb_data_home_dir=      @mysqld.1.datadir
+innodb_log_group_home_dir= @mysqld.1.datadir
+innodb_data_file_path=     @mysqld.loose-innodb_data_file_path
+
+[mysqld.1]
+innodb_data_home_dir= @mysqld.1.datadir
+innodb_log_group_home_dir= @mysqld.1.datadir
+
+[ENV]
+DATA_DIR=   @mysqld.1.datadir
+TMP_DIR=    @mysqld.1.tmpdir
+IDATA_PATH= @mysqld.innodb_data_file_path
+ILOG_SIZE=  @mysqld.innodb_log_file_size
+ILOG_COUNT= @mysqld.innodb_log_files_in_group

=== added file 'mysql-test/suite/meb/t/ibb_example.test'
--- a/mysql-test/suite/meb/t/ibb_example.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/meb/t/ibb_example.test	2010-05-04 12:05:12 +0000
@@ -0,0 +1,32 @@
+--source include/have_innodb.inc
+--source include/have_meb.inc
+
+--echo "IBBACKUP   is: $IBBACKUP"
+--echo "INNOBACKUP is: $INNOBACKUP"
+--echo "DATA_DIR   is: $DATA_DIR"
+--echo "BACKUP_DIR is: $BACKUP_DIR"
+--echo "SERVER_CNF is: $SERVER_CNF"
+--echo "BACKUP_CNF is: $BACKUP_CNF"
+
+--echo == Preparing test data
+--disable_query_log
+let $ENGINE_1 = MyISAM;
+let $ENGINE_2 = InnoDB;
+let $ENGINE_3 = InnoDB;
+let $ENGINE_3_USES_TABLESPACE = 0;
+--source suite/meb/include/extreme_data.inc
+--enable_query_log
+
+--echo == Running ibbackup
+--exec $IBBACKUP $SERVER_CNF $BACKUP_CNF
+--exec ls -l $BACKUP_DIR
+
+--echo == Applying log
+--exec $IBBACKUP --apply-log $BACKUP_CNF
+--exec ls -l $BACKUP_DIR
+
+# TODO: restart server with restored data.
+
+--echo == DONE ==
+--abort
+--exit

=== added file 'mysql-test/suite/meb/t/inb_example.test'
--- a/mysql-test/suite/meb/t/inb_example.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/meb/t/inb_example.test	2010-05-04 12:05:12 +0000
@@ -0,0 +1,38 @@
+--source include/have_innodb.inc
+--source include/have_meb.inc
+
+--echo "IBBACKUP   is: $IBBACKUP"
+--echo "INNOBACKUP is: $INNOBACKUP"
+--echo "DATA_DIR   is: $DATA_DIR"
+--echo "BACKUP_DIR is: $BACKUP_DIR"
+--echo "SERVER_CNF is: $SERVER_CNF"
+--echo "BACKUP_CNF is: $BACKUP_CNF"
+
+--echo == Preparing test data
+--disable_query_log
+let $ENGINE_1 = MyISAM;
+let $ENGINE_2 = InnoDB;
+let $ENGINE_3 = InnoDB;
+let $ENGINE_3_USES_TABLESPACE = 0;
+--source suite/meb/include/extreme_data.inc
+--enable_query_log
+
+let $inbopts= --no-timestamp;
+let $inbopts= $inbopts --port=$MASTER_MYPORT;
+let $inbopts= $inbopts --user=root; 
+
+# Note: The destination directory $BACKUP_DIR/innobackup must not exist.
+
+--echo == Running innobackup
+--exec $INNOBACKUP $inbopts $SERVER_CNF $BACKUP_DIR/innobackup 2>&1
+--exec ls -l $BACKUP_DIR/innobackup
+
+--echo == Applying log
+--exec $INNOBACKUP $inbopts --apply-log $SERVER_CNF $BACKUP_DIR/innobackup 2>&1
+--exec ls -l $BACKUP_DIR/innobackup
+
+# TODO: restore part (stop server, copy files, restart server).
+
+--echo == DONE ==
+--abort
+--exit


Attachment: [text/bzr-bundle] bzr/rafal.somla@sun.com-20100504120512-dqows0buq4qpgce7.bundle
Thread
bzr commit into mysql-5.1 branch (Rafal.Somla:3450)Rafal Somla4 May