List:Commits« Previous MessageNext Message »
From:Jorgen Loland Date:August 27 2009 11:36am
Subject:bzr commit into mysql-6.0-backup branch (jorgen.loland:2864) WL#4769
View as plain text  
#At file:///localhome/jl208045/mysql/mysql-6.0-backup-review1/ based on revid:jorgen.loland@stripped

 2864 Jorgen Loland	2009-08-27
      WL#4769 - Backup: Test validity point without micro-managing sync points
      
      Follow-up patch
     @ mysql-test/collections/mysql-6.0-backup.daily
        Make Backup Validity Point test execute daily.

    modified:
      mysql-test/collections/mysql-6.0-backup.daily
      mysql-test/suite/backup_extra/vptest/run_vp_test.pl
=== modified file 'mysql-test/collections/mysql-6.0-backup.daily'
--- a/mysql-test/collections/mysql-6.0-backup.daily	2009-08-03 00:36:07 +0000
+++ b/mysql-test/collections/mysql-6.0-backup.daily	2009-08-27 11:35:59 +0000
@@ -1,3 +1,4 @@
 perl mysql-test-run.pl --timer --comment=object_coverage --suite=backup_extra backup_object_coverage
 perl mysql-test-run.pl --timer --comment=consistency_innodb --force --suite=backup_extra backup_consistency_innodb
 perl mysql-test-run.pl --timer --comment=backup_interoperability --suite=backup_extra backup_interop
+perl ./suite/backup_extra/vptest/run_vp_test.pl --mysql-dir=../ --datadump-dir=$FLIGHTSTATS_PATH
\ No newline at end of file

=== modified file 'mysql-test/suite/backup_extra/vptest/run_vp_test.pl'
--- a/mysql-test/suite/backup_extra/vptest/run_vp_test.pl	2009-08-26 12:36:04 +0000
+++ b/mysql-test/suite/backup_extra/vptest/run_vp_test.pl	2009-08-27 11:35:59 +0000
@@ -12,6 +12,7 @@ use File::Spec;
 my $mtr_build_thread_def=74;
 my $mtr_build_thread_option; # May be set by CL option
 my $start_dir = cwd();
+# For future platform indepencene. Script not usable on Win currently
 my $ext=".exe" if windows();
 
 my $stress_duration = 2000; # But is killed once backup is done
@@ -51,6 +52,7 @@ if (!$opt_result) {
 }
 
 check_options();
+exit_if_not_nix();
 
 my $test_dir=$mysql_dir."/mysql-test/";
 my $master_dir=$test_dir."var/mysqld.1/";
@@ -67,7 +69,8 @@ my $backup_file="flight.bak";
 my $dump_file_orig=$tmpfile_dir."dump_orig_db.sql";
 my $dump_file_restore=$tmpfile_dir."dump_restored_db.sql";
 my $diff_file=$tmpfile_dir."dump.diff";
-my $sql_outfile=$tmpfile_dir."sql_out.diff";
+my $sql_outfile=$tmpfile_dir."sql_out.txt";
+my $server_outfile=$tmpfile_dir."server_out.txt";
 
 # Make sure version 2 of MTR is used
 $ENV{MTR_VERSION} = 2;
@@ -87,6 +90,7 @@ my $dbh;
 # Main script
 # ***********
 
+
 # ---------------------------
 # SCRIPT PART I: Preparations
 # ---------------------------
@@ -106,6 +110,10 @@ start_server("");
 # Create a database on the main server
 create_database();
 
+# Copy database to slave database location
+create_slave_copy();
+sleep(10); # Make sure servers are actually started.
+
 # ---------------------------------------------------------------------
 # SCRIPT PART II: Backup database on main server during concurrent load 
 # ---------------------------------------------------------------------
@@ -184,7 +192,6 @@ sub print_usage {
 }
 
 sub cleanup {
-
     shutdown_server();
 }
 
@@ -347,16 +354,25 @@ sub run_stress {
 
 }    
 
+# TODO: Make platform independent when/if Perl::Copy::Recursive is
+# made available in PB2
 sub create_slave_copy {
     shutdown_server();
 
-    # Copy database
     print("Delete existing slave data files\n");    
-    # Equivalent to 'rm -r'
-    rmtree(glob("$slave_dir/"),  {keep_root => 1});
+    # TODO: Fix rmtree if script is made platform independent. Should
+    # be equivalent to 'rm -r', but sometimes deletes root dir as
+    # well. Calling rm and cp instead since script relies on
+    # *nix
+    #  rmtree(glob("$slave_dir/data/"),  {keep_root => 1});
+    #
+    # TODO: Enable fcopy when Perl::Copy::Recursive is available in PB2
+    #  fcopy($master_dir/data/,$slave_dir/data/) or die $!;
+    #
+    system("rm -r $slave_dir/data/*");
     print("Copying database to slave location\n");    
-    dircopy($master_dir, $slave_dir);
-
+    system("cp -r $master_dir/data/* $slave_dir/data/");
+    
     start_server("--start-dirty");
     return 0;
 }
@@ -373,25 +389,6 @@ sub shutdown_server {
     return 0;
 }
 
-sub dircopy {
-    my ($from, $to) =@_;
-    opendir my($handle), $from or die "Could not open dir '$from': $!";
-    for my $file (readdir $handle) {
-        next if ($file eq '.') or ($file eq '..');
-        my $source = "$from/$file";
-        my $destination = "$to/$file";
-        if (-d $source) {
-            mkdir $destination or die "mkdir '$destination' failed: $!";
-            dircopy($source, $destination);
-        } else {
-            copy($source, $destination) or die $!;
-        }
-    }
-    closedir $handle;
-    return 0;
-}
-
-
 sub create_database {
 
     # Creating flightstats_test dabase and insert data
@@ -405,7 +402,7 @@ sub create_database {
     
     $ret_code=system($client_dir."/mysql ".$mysql_args." < ".$schema_file);
     if ($ret_code >> 8) { 
-        print("\n Failed to create database - Aborting\n");
+        print("\nFailed to create database - Aborting\n");
         cleanup();
         exit(1);
     }
@@ -498,7 +495,8 @@ sub start_server {
         # This is the thread that starts the servers;
         # start_masterslave starts both servers
         chdir($test_dir);
-        $ret_code=system("perl $server_start_script ".$mysql_args);
+        $ret_code=system("perl $server_start_script ".$mysql_args.
+                         ">> ".$server_outfile." 2>&1");
         exit(0);
     } else {
         # This is the main thread
@@ -526,8 +524,9 @@ sub check_options {
     }
 
     if (! -e $datadump_dir."/aircraft.dat") {
-        print_usage("Could not find test data in: \'".$datadump_dir."\'\n");
-        exit(1);
+        print_usage("Could not find test data in: \'".$datadump_dir.
+                    "\'\nTEST WAS SKIPPED\n");
+        exit(0);
     }
 
     if (!$schema_file) {
@@ -563,3 +562,16 @@ sub windows {
         ($^O eq 'cygwin' )
       ) { return 1; } else { return 0; }
 }
+
+sub exit_if_not_nix {
+    if (($^O eq 'solaris') || ($^O eq 'linux' )) {
+        print ("Operating system \'".$^O."\' found. ".
+              "Test can run on this platform\n");
+       return 1; 
+    } else  {
+        print ("Operating system \'".$^O."\' found. ".
+               "Test can NOT run on this platform\n");
+        exit(0);
+    }
+}
+


Attachment: [text/bzr-bundle] bzr/jorgen.loland@sun.com-20090827113559-pwm9j1uinq52je1g.bundle
Thread
bzr commit into mysql-6.0-backup branch (jorgen.loland:2864) WL#4769Jorgen Loland27 Aug
  • Re: bzr commit into mysql-6.0-backup branch (jorgen.loland:2864)WL#4769Rafal Somla4 Sep