[packages/mysql] mysqldumpslow: process clusters.conf for default mysqld.conf location
glen
glen at pld-linux.org
Sat Sep 6 19:59:48 CEST 2014
commit 4256f5531a4ed577c755dd49d69145f5ec52f7cf
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sat Sep 6 20:57:15 2014 +0300
mysqldumpslow: process clusters.conf for default mysqld.conf location
mysql.spec | 2 ++
mysqldumpslow-clusters.patch | 46 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+)
---
diff --git a/mysql.spec b/mysql.spec
index 8bfceec..0c59b0f 100644
--- a/mysql.spec
+++ b/mysql.spec
@@ -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
index 0000000..415ab93
--- /dev/null
+++ b/mysqldumpslow-clusters.patch
@@ -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);
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/mysql.git/commitdiff/5da41d2ab056475240c3007a6e290533baa74446
More information about the pld-cvs-commit
mailing list