[MDEV-10534] mysqld_multi unsafe shutdown (with patch) Created: 2016-08-10 Updated: 2019-04-10 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Scripts & Clients |
| Affects Version/s: | 10.0.25 |
| Fix Version/s: | 10.1 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Wolfgang Illmeyer | Assignee: | Nikita Malyavin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | foundation, upstream-wontfix | ||
| Attachments: |
|
| Description |
|
/usr/bin/mysld_multi sends the processes intended to shutdown the database servers into the background. This way, when called during the shutdown sequence of the computer, a safe shutdown can not be guaranteed. In fact, if you use e.g. systemd, the background processes will be killed as soon as the script ends, which often isn't enough to even initiate the shutdown sequence of more than one server. The shutdown part of the script MUST wait for the shutdown process to finish. For the fix, I just removed the to-the-background part in the script, which might slow the process down a bit, because the servers are stopped in sequence. It wouldn't be so trivial to start the processes in parallel and track them all in perl, so I left it this way. I originally found this in mysql-5.5, but I decided to post it here, because MariaDB's script has the same problem. Also, maybe somebody will be so nice as to forward this bug to the MySQL-people, because I can't register at the MySQL bugtracker because I refuse to give them all the data they require for an Oracle account, just for a bug report. |
| Comments |
| Comment by Elena Stepanova [ 2016-08-10 ] |
|
filed http://bugs.mysql.com/bug.php?id=82534, as you requested. I'm not sure however that serializing shutdown as it's done in the patch is a good idea. It might not just "slow the process down a bit", it can be quite a blow on the overall shutdown time, even if it's one server, and for several servers it's likely to be intolerable. For example, we routinely receive complaints that 5-10 min timeouts for server shutdown in other scripts are not enough for busy servers. I think the approach should be considered more carefully. |
| Comment by Daniel Black [ 2018-02-11 ] |
|
mysqld_multi was never really designed to run under systemd. Though the initial systemd scripts for multi-instance where a rough example I've cleaned these up in To stop multiple concurrent services with systemd it seems you can use systemctl stop x.service y.service however I think what you where saying is multiple service where under the same systemd service, which becomes harder to manage. A ExecStopPost section on waiting for all instances (like waitpid examples in mysqld_safe and other distro implmentations) to stop would be an alternative to what you proposed. Using this method would enable multiple mariadb shutdowns to occur concurrently. Looks like upstream-wontfix too because they consider systemd services as a replacement. I know its been a while since you proposed this however feedback is welcome. Daniel |
| Comment by Sergei Golubchik [ 2018-03-12 ] |
|
may be just add wait(2) after all mysqladmins were started? |