]> git.pld-linux.org Git - packages/mysql.git/commitdiff
mysqldumpslow: process clusters.conf for default mysqld.conf location
authorElan Ruusamäe <glen@delfi.ee>
Sat, 6 Sep 2014 17:57:15 +0000 (20:57 +0300)
committerElan Ruusamäe <glen@delfi.ee>
Sat, 6 Sep 2014 17:58:09 +0000 (20:58 +0300)
mysql.spec
mysqldumpslow-clusters.patch [new file with mode: 0644]

index 8bfceec53ede3c22d6e1ed48f9aecce1f76ff989..0c59b0f431cb8d11be54a681f973677520ff1a36 100644 (file)
@@ -78,6 +78,7 @@ Patch22:      bug-66589.patch
 Patch23:       bug-44278.patch
 Patch24:       %{name}-cmake.patch
 Patch25:       %{name}-readline.patch
+Patch26:       mysqldumpslow-clusters.patch
 URL:           http://www.mysql.com/products/community/
 BuildRequires: bison >= 1.875
 BuildRequires: cmake >= 2.6
@@ -521,6 +522,7 @@ mv sphinx-*/mysqlse storage/sphinx
 %patch23 -p1
 %patch24 -p1
 %patch25 -p1
+%patch26 -p1
 
 # to get these files rebuild
 [ -f sql/sql_yacc.cc ] && rm sql/sql_yacc.cc
diff --git a/mysqldumpslow-clusters.patch b/mysqldumpslow-clusters.patch
new file mode 100644 (file)
index 0000000..415ab93
--- /dev/null
@@ -0,0 +1,46 @@
+--- percona-server-5.6.20-68.0/scripts/mysqldumpslow.sh~       2014-08-29 10:58:05.000000000 +0300
++++ percona-server-5.6.20-68.0/scripts/mysqldumpslow.sh        2014-09-06 20:50:22.000000000 +0300
+@@ -51,8 +51,33 @@
+ $opt{'help'} and usage();
++# find config file for first defined cluster
++sub get_defaults_file {
++      my $clusters_file = '/etc/mysql/clusters.conf';
++      return unless -f $clusters_file;
++
++      open(my $fh , "< $clusters_file") or return;
++      while (<$fh>) {
++              my ($config, $clusterdir) = m{^([^#]+)\s*=\s*(.+)$};
++              next unless $config;
++
++              if ($config !~ m{/}) {
++                      my $f = "/etc/mysql/$config";
++                      return $f if -f $f;
++
++                      my $f = "$clusterdir/$config";
++                      return $f if -f $f;
++              }
++              return $config;
++      }
++      close($fh) or die $!;
++      return undef;
++}
++
+ unless (@ARGV) {
+-    my $defaults   = `my_print_defaults mysqld`;
++      my $defaults_file = get_defaults_file;
++      my $defaults_arg = "-c $defaults_file" if $defaults_file;
++   my $defaults   = `my_print_defaults $defaults_arg mysqld`;
+     my $basedir = ($defaults =~ m/--basedir=(.*)/)[0]
+       or die "Can't determine basedir from 'my_print_defaults mysqld' output: $defaults";
+     warn "basedir=$basedir\n" if $opt{v};
+@@ -61,7 +86,7 @@
+     my $slowlog = ($defaults =~ m/--slow-query-log-file=(.*)/)[0];
+     if (!$datadir or $opt{i}) {
+       # determine the datadir from the instances section of /etc/my.cnf, if any
+-      my $instances  = `my_print_defaults instances`;
++      my $instances  = `my_print_defaults $defaults_arg instances`;
+       die "Can't determine datadir from 'my_print_defaults mysqld' output: $defaults"
+           unless $instances;
+       my @instances = ($instances =~ m/^--(\w+)-/mg);
This page took 0.181917 seconds and 4 git commands to generate.