List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:June 18 2009 3:42pm
Subject:bzr commit into mysql-5.0-bugteam branch (joro:2778) Bug#36654
View as plain text  
#At file:///Users/kgeorge/mysql/work/B36654-5.0-bugteam/ based on revid:alexey.kopytov@stripped

 2778 Georgi Kodinov	2009-06-18
      Bug #36654: mysqld_multi cannot start instances with different versions occasionally.
      
      mysql_multi can call mysqld_safe. In doing this it's not changing the current working
      directory. This may cause confusion in the case where mysqld_multi is handling instances
      of servers of different versions and the current working directory is the installation 
      directory of one of these servers.
      
      Added a new option : --changedir to change the current working directory to the 
      data directory (if specified in the relevant mysqldNN section) before doing 
      mysqld_multi ... start ... and then change it back to what it was.
     @ scripts/mysqld_multi.sh
        Bug #36654: optionally preserve, change and restore the cwd when starting server 
        instances

    modified:
      scripts/mysqld_multi.sh
=== modified file 'scripts/mysqld_multi.sh'
--- a/scripts/mysqld_multi.sh	2009-04-02 15:29:28 +0000
+++ b/scripts/mysqld_multi.sh	2009-06-18 15:42:13 +0000
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 
 use Getopt::Long;
-use POSIX qw(strftime);
+use POSIX qw(strftime getcwd);
 
 $|=1;
 $VER="2.16";
@@ -20,6 +20,7 @@ $opt_user          = "root";
 $opt_version       = 0;
 $opt_silent        = 0;
 $opt_verbose       = 0;
+$opt_changedir     = 0;
 
 my $my_print_defaults_exists= 1;
 my $logdir= undef();
@@ -87,7 +88,7 @@ sub main
   # We've already handled --no-defaults, --defaults-file, etc.
   if (!GetOptions("help", "example", "version", "mysqld=s", "mysqladmin=s",
                   "user=s", "password=s", "log=s", "no-log",
-                  "tcp-ip",  "silent", "verbose"))
+                  "tcp-ip",  "silent", "verbose", "changedir"))
   {
     $flag_exit= 1;
   }
@@ -298,6 +299,7 @@ sub start_mysqlds()
     $mysqld_found= 1; # The default
     $mysqld_found= 0 if (!length($mysqld));
     $com= "$mysqld";
+    $datadir_found= 1; # The default
     for ($j = 0, $tmp= ""; defined($options[$j]); $j++)
     {
       if ("--mysqladmin=" eq substr($options[$j], 0, 13))
@@ -310,6 +312,12 @@ sub start_mysqlds()
 	$com= $options[$j];
         $mysqld_found= 1;
       }
+      elsif ("--datadir=" eq substr($options[$j], 0, 9))
+      {
+	$options[$j]=~ s/\-\-datadir\=//;
+	$datadir= $options[$j];
+        $datadir_found= 1;
+      }
       else
       {
 	$options[$j]= quote_shell_word($options[$j]);
@@ -337,7 +345,16 @@ sub start_mysqlds()
       print "group [$groups[$i]] separately.\n";
       exit(1);
     }
+    if ($opt_changedir && $datadir_found)
+    {
+      $curdir=getcwd();
+      chdir($datadir) or die "Can't change to datadir $datadir";
+    }
     system($com);
+    if ($opt_changedir && $datadir_found)
+    {
+      chdir($curdir) or die "Can't change back to original dir $curdir";
+    }
   }
   if (!$i && !$opt_no_log)
   {
@@ -749,6 +766,8 @@ These options must be given before any o
                    standard system-wide and user-specific files
 Using:  @{[join ' ', @defaults_options]}
 
+--changedir        Change the working directory to datadir (if specified) 
+                   before starting the individual servers.
 --config-file=...  Deprecated, please use --defaults-extra-file instead
 --example          Give an example of a config file with extra information.
 --help             Print this help and exit.


Attachment: [text/bzr-bundle] bzr/joro@sun.com-20090618154213-qd44jaeyy3i1d5s8.bundle
Thread
bzr commit into mysql-5.0-bugteam branch (joro:2778) Bug#36654Georgi Kodinov18 Jun