From 036ca48a16abd1c9685f0fae0721591661045653 Mon Sep 17 00:00:00 2001 From: Honza Horak Date: Mon, 28 Aug 2017 16:35:08 +0200 Subject: [PATCH] Support --defaults-group-suffix option in all starting scripts Resolves: #1485777 --- mariadb.spec | 2 ++ mysql-scripts-common.sh | 12 +++++++++++- mysql@.service.in | 6 +++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/mariadb.spec b/mariadb.spec index a7ec592..1665441 100644 --- a/mariadb.spec +++ b/mariadb.spec @@ -1448,6 +1448,8 @@ fi * Mon Aug 28 2017 Honza Horak - 3:10.2.8-2 - Fix paths in galera_recovery and galera_new_cluster Resolves: #1403416 +- Support --defaults-group-suffix properly in systemd unit file + Resolves: #1485777 * Sun Aug 20 2017 Honza Horak - 3:10.2.8-1 - Rebase to 10.2.8 diff --git a/mysql-scripts-common.sh b/mysql-scripts-common.sh index bf2888f..e270433 100644 --- a/mysql-scripts-common.sh +++ b/mysql-scripts-common.sh @@ -18,13 +18,23 @@ get_mysql_option(){ sections="$1" option_name="$2" default_value="$3" - result=`@bindir@/my_print_defaults $sections | sed -n "s/^--${option_name}=//p" | tail -n 1` + result=`@bindir@/my_print_defaults $my_print_defaults_extra_args $sections | sed -n "s/^--${option_name}=//p" | tail -n 1` if [ -z "$result" ]; then # not found, use default result="${default_value}" fi } +# For the case of running more instances via systemd, scrits that source +# this file can get --default-group-suffix or similar option as the first +# argument. The utility my_print_defaults needs to use it as well, so the +# scripts sourcing this file work with the same options as the daemon. +my_print_defaults_extra_args='' +while echo "$1" | grep -q '^--defaults' ; do + my_print_defaults_extra_args="${my_print_defaults_extra_args} $1" + shift +done + # Defaults here had better match what mysqld_safe will default to # The option values are generally defined on three important places # on the default installation: diff --git a/mysql@.service.in b/mysql@.service.in index a6182aa..3bf386d 100644 --- a/mysql@.service.in +++ b/mysql@.service.in @@ -40,13 +40,13 @@ Type=notify User=mysql Group=mysql -ExecStartPre=@libexecdir@/mysql-check-socket -ExecStartPre=@libexecdir@/mysql-prepare-db-dir %n +ExecStartPre=@libexecdir@/mysql-check-socket --defaults-group-suffix=.%I +ExecStartPre=@libexecdir@/mysql-prepare-db-dir --defaults-group-suffix=.%I %n # MYSQLD_OPTS here is for users to set in /etc/systemd/system/@DAEMON_NAME@@.service.d/MY_SPECIAL.conf # Note: we set --basedir to prevent probes that might trigger SELinux alarms, # per bug #547485 ExecStart=@libexecdir@/mysqld --defaults-group-suffix=.%I --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER -ExecStartPost=@libexecdir@/mysql-check-upgrade +ExecStartPost=@libexecdir@/mysql-check-upgrade --defaults-group-suffix=.%I # Setting this to true can break replication and the Type=notify settings # See also bind-address mysqld option.