Bug #44511 MTR2: add an option not to kill other servers when one from the group exits
Submitted: 28 Apr 2009 11:21 Modified: 29 May 2009 1:14
Reporter: Elena Stepanova Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S4 (Feature request)
Version: OS:Any
Assigned to: Bjørn Munch CPU Architecture:Any

[28 Apr 2009 11:21] Elena Stepanova
Description:
When MTR2 is launched with --start or --start-dirty option to run *more than one* server, e.g. master and slave, it keeps watching all started servers; as soon as at least one of them exits (on whatever reason, even if it was shut down properly), MTR2 kills all other servers immediately and aborts.

It brings some problems in our test routine. For example, in some scenarios we have to keep extra servers running idle just so those we are interested in don't get killed; or, if something happens, e.g. master crashes, we would sometimes prefer to keep slave running for investigation purposes, or at least shut down gracefully, but not killed; etc.

What we need is a way to start a group of servers via MTR, but without the described kind of dependency.

How to repeat:
perl ./mysql-test-run.pl --start rpl_alter

# shut down one of the two started servers, e.g. slave 
=> master dies

Suggested fix:
Description:

Current behavior:
- If MTR2 is launched with --start or --start-dirty, after starting servers it calls subroutine 'wait_any' from SafeProcess.pm, and waits for it to return.
- The subroutine monitors all started processes and returns an error as soon as at least one of monitored processes exits.

Suggested change:
- If MTR2 is launched with --start or --start-dirty option *and a new option --wait-all*, instead of calling 'wait_any' subroutine it will call the new one 'wait_all';
- in all other cases the behavior will be the same as now;
- the new subroutine in SafeProcess.pm will look very similar to wait_any, but will return only when *all* monitored processes exit.

Thus, we encapsulate all changes in SafeProcess.pm in the new function, and in mysql-test-run.pl -- under the new option.
[28 Apr 2009 12:17] 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/72904

2785 Bjorn Munch	2009-04-28
      Bug #44511 MTR2: add an option not to kill other servers when one from the group exits
      MTR would die as soon as one server terminates
      Implemented --wait-all option and associated subroutine
      modified:
        mysql-test/lib/My/SafeProcess.pm
        mysql-test/mysql-test-run.pl
[29 Apr 2009 14:14] 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/73030

2786 Bjorn Munch	2009-04-29
       Bug #44511 MTR2: add an option not to kill other servers when one from the group exits
      MTR would die as soon as one server terminates
      Implemented --wait-all option and associated subroutine
      modified:
        mysql-test/lib/My/SafeProcess.pm
        mysql-test/mysql-test-run.pl
[29 Apr 2009 17:46] Magnus Blåudd
You might want to check if 'wait_any' returns a process and print a message if it doesn't. Or is it enough with the code already at the end of 'wait_any'?
[29 Apr 2009 18:47] Bjørn Munch
Pushed to 6.0-mtr and 5.1-mtr

Response to last comment: code at end of wait_any should be enough
[14 May 2009 16:26] Bugs System
Pushed into 6.0.12-alpha (revid:alik@sun.com-20090514161729-xiup7q8jlu1zfy7s) (version source revid:bjorn.munch@sun.com-20090429184140-noy2sqeo0gwtji4g) (merge vers: 6.0.12-alpha) (pib:6)
[15 May 2009 1:26] Paul DuBois
Test suite changes. No changelog entry needed.

Setting report to NDI pending push into 5.1.x.
[28 May 2009 8:15] Bugs System
Pushed into 5.1.36 (revid:joro@sun.com-20090528073639-yohsb4q1jzg7ycws) (version source revid:bjorn.munch@sun.com-20090525205831-zitq9aysxy5zgf5r) (merge vers: 5.1.36) (pib:6)
[29 May 2009 1:14] Paul DuBois
Test suite change. No changelog entry needed.
[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:32] 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)