SHA256
1
0
forked from pool/mariadb
mariadb/mariadb-10.1.1-mysqld_multi-features.patch
Adam Majer e4b2876888 Accepting request 563119 from home:kstreitova:branches:server:database
- update to 10.2.12 GA
   * release notes and changelog:
     https://mariadb.com/kb/en/library/mariadb-10212-release-notes/
     https://mariadb.com/kb/en/library/mariadb-10212-changelog/
- remove mysql-community-server-5.5.6-safe-process-in-bin.patch
  becuase this moving is done in the specfile
- get rid of the archive with patches (remove mysql-patches.tar.xz
  and series files), handle patches in the standard way
- add comments to the section with removing unused files (based on
  https://lists.launchpad.net/maria-developers/msg11028.html)
- put rm statements together
- install the new upstream systemd-tmpfiles configuration file
  'tmpfiles.conf' and rename it to 'mariadb.conf' in order to
  follow the manual
- remove the new upstream systemd-sysusers configuration file as
  we handle creating of mysql user in the specfile
- mysql.service: remove calling of the wait function and let
  systemd to do this job. Switch from 'Type=simple' to
  'Type=notify' and add TimeoutSec=300
- rename unit files from mysql to mariadb and add mysql alias for
  the backward compatibility [bsc#1067443]
  * mysql.service -> mariadb.service
  * mysql.target -> mariadb.target
  * mysql@.service -> mariadb@.service
- remove configuration-tweaks.tar.xz and move configuration to
  my.ini/my.cnf file (omit default_plugins.cnf as all
  configuration here was commented out)
- add a numeric prefix for galera.cnf file in order to allow users
  to speficy in which order the configs will be loaded within the
  my.cnf.d directory [bsc#1055268]

OBS-URL: https://build.opensuse.org/request/show/563119
OBS-URL: https://build.opensuse.org/package/show/server:database/mariadb?expand=0&rev=203
2018-01-09 18:28:29 +00:00

180 lines
5.6 KiB
Diff

PATCH-P0-FEATURE-UPSTREAM: Add more functionality to mysqld_multi script
Adds reload funcionality to mysqld_multi.sh perl script and adds --datadir
support.
Maintainer: Michal Hrusecky <Michal.Hrusecky@opensuse.org>
Index: scripts/mysqld_multi.sh
===================================================================
--- scripts/mysqld_multi.sh.orig
+++ scripts/mysqld_multi.sh
@@ -36,6 +36,7 @@
use Getopt::Long;
use POSIX qw(strftime getcwd);
+use File::Path qw(mkpath);
$|=1;
$VER="2.20";
@@ -162,6 +163,7 @@ sub main
usage() if (!defined($ARGV[0]) ||
(!($ARGV[0] =~ m/^start$/i) &&
!($ARGV[0] =~ m/^stop$/i) &&
+ !($ARGV[0] =~ m/^reload$/i) &&
!($ARGV[0] =~ m/^report$/i)));
if (!$opt_no_log)
@@ -175,7 +177,7 @@ sub main
print strftime "%a %b %e %H:%M:%S %Y", localtime;
print "\n";
}
- if ($ARGV[0] =~ m/^start$/i)
+ if (($ARGV[0] =~ m/^start$/i) || ($ARGV[0] =~ m/^reload$/i))
{
if (!defined(($mysqld= my_which($opt_mysqld))) && $opt_verbose)
{
@@ -184,7 +186,11 @@ sub main
print "This is OK, if you are using option \"mysqld=...\" in ";
print "groups [mysqldN] separately for each.\n\n";
}
- start_mysqlds();
+ if ($ARGV[0] =~ m/^start$/i) {
+ start_mysqlds();
+ } elsif ($ARGV[0] =~ m/^reload$/i) {
+ reload_mysqlds();
+ }
}
else
{
@@ -344,6 +350,39 @@ sub start_mysqlds()
$com= "$mysqld";
for ($j = 0, $tmp= ""; defined($options[$j]); $j++)
{
+ if ("--datadir=" eq substr($options[$j], 0, 10)) {
+ $datadir = $options[$j];
+ $datadir =~ s/\-\-datadir\=//;
+ eval { mkpath($datadir) };
+ if ($@) {
+ print "FATAL ERROR: Cannot create data directory $datadir: $!\n";
+ exit(1);
+ }
+ if (! -d $datadir."/mysql") {
+ if (-w $datadir) {
+ print "\n\nInstalling new database in $datadir\n\n";
+ $install_cmd="@bindir@/mysql_install_db ";
+ $install_cmd.="--user=mysql ";
+ $install_cmd.="--datadir=$datadir";
+ system($install_cmd);
+ } else {
+ print "\n";
+ print "FATAL ERROR: Tried to create mysqld under group [$groups[$i]],\n";
+ print "but the data directory is not writable.\n";
+ print "data directory used: $datadir\n";
+ exit(1);
+ }
+ }
+
+ if (! -d $datadir."/mysql") {
+ print "\n";
+ print "FATAL ERROR: Tried to start mysqld under group [$groups[$i]],\n";
+ print "but no data directory was found or could be created.\n";
+ print "data directory used: $datadir\n";
+ exit(1);
+ }
+ }
+
if ("--mysqladmin=" eq substr($options[$j], 0, 13))
{
# catch this and ignore
@@ -408,6 +447,58 @@ sub start_mysqlds()
}
####
+#### reload multiple servers
+####
+
+sub reload_mysqlds()
+{
+ my (@groups, $com, $tmp, $i, @options, $j);
+
+ if (!$opt_no_log)
+ {
+ w2log("\nReloading MySQL servers\n","$opt_log",0,0);
+ }
+ else
+ {
+ print "\nReloading MySQL servers\n";
+ }
+ @groups = &find_groups($groupids);
+ for ($i = 0; defined($groups[$i]); $i++)
+ {
+ $mysqld_server = $mysqld;
+ @options = defaults_for_group($groups[$i]);
+
+ for ($j = 0, $tmp= ""; defined($options[$j]); $j++)
+ {
+ if ("--mysqladmin=" eq substr($options[$j], 0, 13))
+ {
+ # catch this and ignore
+ }
+ elsif ("--mysqld=" eq substr($options[$j], 0, 9))
+ {
+ $options[$j] =~ s/\-\-mysqld\=//;
+ $mysqld_server = $options[$j];
+ }
+ elsif ("--pid-file=" eq substr($options[$j], 0, 11))
+ {
+ $options[$j] =~ s/\-\-pid-file\=//;
+ $pid_file = $options[$j];
+ }
+ }
+ $com = "killproc -p $pid_file -HUP $mysqld_server";
+ system($com);
+
+ $com = "touch $pid_file";
+ system($com);
+ }
+ if (!$i && !$opt_no_log)
+ {
+ w2log("No MySQL servers to be reloaded (check your GNRs)",
+ "$opt_log", 0, 0);
+ }
+}
+
+###
#### stop multiple servers
####
@@ -770,7 +861,7 @@ sub usage
$my_progname version $VER by Jani Tolonen
Description:
-$my_progname can be used to start, or stop any number of separate
+$my_progname can be used to start, reload, or stop any number of separate
mysqld processes running in different TCP/IP ports and UNIX sockets.
$my_progname can read group [mysqld_multi] from my.cnf file. You may
@@ -788,16 +879,16 @@ integer starting from 1. These groups sh
[mysqld] group, but with those port, socket and any other options
that are to be used with each separate mysqld process. The number
in the group name has another function; it can be used for starting,
-stopping, or reporting any specific mysqld server.
+reloading, stopping, or reporting any specific mysqld server.
-Usage: $my_progname [OPTIONS] {start|stop|report} [GNR,GNR,GNR...]
-or $my_progname [OPTIONS] {start|stop|report} [GNR-GNR,GNR,GNR-GNR,...]
+Usage: $my_progname [OPTIONS] {start|reload|stop|report} [GNR,GNR,GNR...]
+or $my_progname [OPTIONS] {start|reload|stop|report} [GNR-GNR,GNR,GNR-GNR,...]
-The GNR means the group number. You can start, stop or report any GNR,
+The GNR means the group number. You can start, reload, stop or report any GNR,
or several of them at the same time. (See --example) The GNRs list can
be comma separated or a dash combined. The latter means that all the
GNRs between GNR1-GNR2 will be affected. Without GNR argument all the
-groups found will either be started, stopped, or reported. Note that
+groups found will either be started, reloaded, stopped, or reported. Note that
syntax for specifying GNRs must appear without spaces.
Options: