diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-06-30 16:38:05 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-06-30 16:38:05 +0200 |
commit | 932646b1ff6a8f5815a961340a9e1ee4702f5b44 (patch) | |
tree | 5bc42ace8ae1f7e4d00baffd468bdb7564e851f1 /support-files | |
parent | 0bb30f3603b519780eaf3fe0527b1c6af285229a (diff) | |
parent | 33492ec8d4e2077cf8e07d0628a959d8729bd1f9 (diff) | |
download | mariadb-git-932646b1ff6a8f5815a961340a9e1ee4702f5b44.tar.gz |
Merge branch '10.1' into 10.2
Diffstat (limited to 'support-files')
-rw-r--r-- | support-files/mariadb.service.in | 13 | ||||
-rw-r--r-- | support-files/mariadb@.service.in | 26 |
2 files changed, 36 insertions, 3 deletions
diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in index b18674bea46..55202c696fb 100644 --- a/support-files/mariadb.service.in +++ b/support-files/mariadb.service.in @@ -48,6 +48,14 @@ CapabilityBoundingSet=CAP_IPC_LOCK # Execute pre and post scripts as root, otherwise it does it as User= PermissionsStartOnly=true +# Perform automatic wsrep recovery. When server is started without wsrep, +# galera_recovery simply returns an empty string. In any case, however, +# the script is not expected to return with a non-zero status. +# It is always safe to unset _WSREP_START_POSITION environment variable. +ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION" +ExecStartPre=/bin/sh -c "VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && \ + systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1" + # Needed to create system tables etc. # ExecStartPre=/usr/bin/mysql_install_db -u mysql @@ -57,9 +65,12 @@ PermissionsStartOnly=true # This isn't a replacement for my.cnf. # _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster @SYSTEMD_EXECSTARTPRE@ -ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER +ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION @SYSTEMD_EXECSTARTPOST@ +# Unset _WSREP_START_POSITION environment variable. +ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION" + KillMode=process KillSignal=SIGTERM diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in index fb3b4b5f41d..18adf0e0eac 100644 --- a/support-files/mariadb@.service.in +++ b/support-files/mariadb@.service.in @@ -55,6 +55,21 @@ CapabilityBoundingSet=CAP_IPC_LOCK # Execute pre and post scripts as root, otherwise it does it as User= PermissionsStartOnly=true +# Perform automatic wsrep recovery. When server is started without wsrep, +# galera_recovery simply returns an empty string. In any case, however, +# the script is not expected to return with a non-zero status. +# It is always safe to unset _WSREP_START_POSITION%I environment variable. +ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION%I" +ExecStartPre=/bin/sh -c "VAR=`/usr/bin/galera_recovery \ + --defaults-file=@INSTALL_SYSCONF2DIR@/my%I.cnf`; [ $? -eq 0 ] && \ + systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1" +# Alternate: (remove ConditionPathExists above) +# use [mysqld.INSTANCENAME] as sections in my.cnf +# +#ExecStartPre=/bin/sh -c "VAR=`/usr/bin/galera_recovery \ +# --defaults-group-suffix=%I`; [ $? -eq 0 ] && \ +# systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1" + # Needed to create system tables etc. # ExecStartPre=/usr/bin/mysql_install_db -u mysql @@ -64,11 +79,18 @@ PermissionsStartOnly=true # This isn't a replacement for my.cnf. # _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster -ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER --defaults-file=@INSTALL_SYSCONF2DIR@/my%I.cnf +# Note: Place $MYSQLD_OPTS at the very end for its options to take precedence. + +ExecStart=/usr/sbin/mysqld --defaults-file=@INSTALL_SYSCONF2DIR@/my%I.cnf \ + $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION%I $MYSQLD_OPTS # Alternate: (remove ConditionPathExists above) # use [mysqld.INSTANCENAME] as sections in my.cnf # -# ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS --defaults-group-suffix=%I +# ExecStart=/usr/sbin/mysqld --defaults-group-suffix=%I \ +# $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION%I $MYSQLD_OPTS + +# Unset _WSREP_START_POSITION environment variable. +ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION%I" KillMode=process KillSignal=SIGTERM |