Bug #36654 mysqld_multi cannot start instances with different versions occasionally.
Submitted: 12 May 2008 0:52 Modified: 17 Jul 2009 3:03
Reporter: Mikiya Okuno Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.60 OS:Any
Assigned to: Georgi Kodinov
Tags: mysqld_multi, mysqld_safe
Triage: Triaged: D2 (Serious) / R3 (Medium)

[12 May 2008 0:52] Mikiya Okuno
Description:
mysqld_multi sometimes fails to start instances with different versions of MySQL Server.

While mysqld_safe tries to find the server and databases relative to its own working directory, we have to run mysqld_safe from the MySQL installation directory if there is multiple installation.

This prevents mysqld_multi from starting even if there are correct basedir and mysqld option in the [mysqldN] section. In this case, the error like following is displayed in the error log. I guess error messages will depends.

 080509 17:44:54  mysqld started
 080509 17:44:54 [ERROR] Error message file '/usr/local/mysql-5.0.51b-osx10.5-x86/share/mysql/english/errmsg.sys' had only 475 error messages,
but it should contain at least 476 error messages.
 Check that the above file is the right version for this program!
 080509 17:44:54 [ERROR] Aborting

The effective workaround is define mysqld option like below:

mysqld="cd /usr/local/mysql-5.0.51b-osx10.5-x86/;bin/mysqld_safe"

This changes a current working directory before executes mysqld_safe within a single command line. But this is not beautiful, and should be modified so that mysqld_multi change the CWD using basedir defined in each [mysqldN] section before it kicks mysqld_safe.

How to repeat:
Run the different version of MySQL using mysqld_multi like, 5.0.51b/5.0.60/5.1.24.

Suggested fix:
mysqld_multi should change the CWD using basedir defined in each [mysqldN] section before it kicks mysqld_safe.
[18 Jun 2009 14:59] Georgi Kodinov
This happens only if the current working directory where one starts mysqld_multi from is the one of the server's base install directory. if the current working directory is any other directory it's working just fine.
[18 Jun 2009 15:47] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/76580

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
[18 Jun 2009 16:34] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/76583

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
[18 Jun 2009 16:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/76584

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
[19 Jun 2009 9:26] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/76647

2778 Georgi Kodinov	2009-06-19
      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
[19 Jun 2009 12:18] Mikiya Okuno
I tested the patch, but the problem happens still. I guess directory should be changed to basedir instead of datadir.

Kind regards,
Mikiya
[19 Jun 2009 13:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/76697

2778 Georgi Kodinov	2009-06-19
      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.
      
      Fixed by enhancing the meaning of basedir in [mysqldN] sections of 
      mysqld_multi. If specified, mysqld_multi will change the current 
      working directory to the basedir directory before starting the server 
      in 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
[19 Jun 2009 13:42] Mikiya Okuno
The new patch worked finely!!
[19 Jun 2009 15:26] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/76723

2781 Georgi Kodinov	2009-06-19
      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.
      
      Fixed by enhancing the meaning of basedir in [mysqldN] sections of 
      mysqld_multi. If specified, mysqld_multi will change the current 
      working directory to the basedir directory before starting the server 
      in 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
[7 Jul 2009 7:52] Bugs System
Pushed into 5.0.84 (revid:joro@sun.com-20090707074938-ksah1ibn0vs92cem) (version source revid:matthias.leich@sun.com-20090619165310-a721aai2e5eg1afl) (merge vers: 5.0.84) (pib:11)
[8 Jul 2009 13:30] Bugs System
Pushed into 5.1.37 (revid:joro@sun.com-20090708131116-kyz8iotbum8w9yic) (version source revid:matthias.leich@sun.com-20090619163449-wgb0tw08ughlzj84) (merge vers: 5.1.36) (pib:11)
[9 Jul 2009 7:35] Bugs System
Pushed into 5.0.84 (revid:joro@sun.com-20090707074938-ksah1ibn0vs92cem) (version source revid:matthias.leich@sun.com-20090619165310-a721aai2e5eg1afl) (merge vers: 5.0.84) (pib:11)
[9 Jul 2009 7:37] Bugs System
Pushed into 5.1.37 (revid:joro@sun.com-20090708131116-kyz8iotbum8w9yic) (version source revid:matthias.leich@sun.com-20090619163449-wgb0tw08ughlzj84) (merge vers: 5.1.36) (pib:11)
[10 Jul 2009 11:21] Bugs System
Pushed into 5.4.4-alpha (revid:anozdrin@bk-internal.mysql.com-20090710111017-bnh2cau84ug1hvei) (version source revid:matthias.leich@sun.com-20090619162244-03lxl1f6t5ip3ko5) (merge vers: 5.4.4-alpha) (pib:11)
[17 Jul 2009 3:03] Paul Dubois
Noted in 5.0.84, 5.1.37, 5.4.4 changelogs.

When invoked to start multiple server instances, mysqld_multi
sometimes would fail to start them all due to not changing location
into the base directory for each instance.
[12 Aug 2009 22:56] Paul Dubois
Noted in 5.4.2 changelog because next 5.4 version will be 5.4.2 and not 5.4.4.
[15 Aug 2009 2:14] Paul Dubois
Ignore previous comment about 5.4.2.
[26 Aug 2009 13:46] Bugs System
Pushed into 5.1.37-ndb-7.0.8 (revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[26 Aug 2009 13:46] Bugs System
Pushed into 5.1.37-ndb-6.3.27 (revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (version source revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (merge vers: 5.1.37-ndb-6.3.27) (pib:11)
[26 Aug 2009 13:48] Bugs System
Pushed into 5.1.37-ndb-6.2.19 (revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (version source revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (merge vers: 5.1.37-ndb-6.2.19) (pib:11)
[27 Aug 2009 16:33] Bugs System
Pushed into 5.1.35-ndb-7.1.0 (revid:magnus.blaudd@sun.com-20090827163030-6o3kk6r2oua159hr) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[8 Oct 2009 20:34] Paul Dubois
The 5.4 fix has been pushed to 5.4.2.