X-Git-Url: https://git.tld-linux.org/?p=packages%2Fmysql.git;a=blobdiff_plain;f=mysqldumpslow-clusters.patch;fp=mysqldumpslow-clusters.patch;h=415ab93477bfb45634704c6928d641a561178c76;hp=0000000000000000000000000000000000000000;hb=6d4f90321faeda56bdcd443d4f9054776bd9cfcf;hpb=da608bb7673207e574610ab4ceae97a34615966c 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);