MySQL Debian/Ubuntu Instance Code is broken
NathanaelA opened this issue · 2 comments
I'm not sure where the actual repo is, since I can't find the MySQL 8 repo with your changes. So I'll report this here, but if you can point me to the proper place, I can move this and even do a PR.
There is three issues with the MySQL Debian Systemd Instance system that I tracked down today when using Gallera/Ws_rep
You guys did modify the normal mysql.service, but the mysql@.service
also needs these changes:
TheType
switch to exec
(I only tried this based on the same comment in the normal mysql.service
, I assume it still applies). And then the additional parameters $MYSQLD_OPTS
and the one customized for the service $MYSQLD_RECOVER_START_%I
Type=exec
ExecStart=/usr/sbin/mysqld --defaults-group-suffix=@%I $MYSQLD_RECOVER_START_%I $MYSQLD_OPTS
The second set of changes is in the helper code mysql-helpers
- I added/changed the following in
get_recover_pos
# added, to return the instance without the "@"
local instanceNoAt=${instance:1}
# changed, we need to prefix it with "mysqld" for this to work...
err_log="$(get_mysql_option mysqld${instance} log-error "/var/log/mysql/error.log")"
# removed data_dir code, as it was also broken (unable to find instance versions), and pointless since mysql should be able to find its datadir based on either its default, no instance, or the instance name all by itself.
# Changed the following ws_recoverer code line to remove the added "@", to this call -- as then you are starting this up as @@instance rather than @instance, also removed --datadir, as that will be found by the instance variable...
mysqld ${instance:+--defaults-group-suffix=$instance} --user=mysql --log-error-verbosity=3 --wsrep_recover 2>> "${err_log}"
# We need the Environmental key to NOT have an "@" in it, because this causes systemctl set-environmental to fail
local key="MYSQLD_RECOVER_START${instance:+_$instanceNoAt}"
systemctl set-environment "$key"="$wsrep_start_position_opt"
- I added/changed the following in
clear_recover_pos
# same issue applies systemctl doesn't like an "@" being part of the env variable
local instance=$1
local instanceNoAt=${instance:1}
systemctl unset-environment MYSQLD_RECOVER_START${instance:+_$instanceNoAt}
The mysqld_bootstrap
file is also does not work for instances, I made the following change to make it work....
I replace the systemctl call with one that appends the first parameter if it is set so that I can do mysqld_boostrap @instancename
if [[ -n $1 ]]; then
systemctl start mysql$1
else.
systemctl start mysql
fi
Hi,
Thanks for the report! We have verified that your findings are correct. The fix will be included in the next release.
Fixed in 8.0.34-26.15.