]> git.pld-linux.org Git - packages/mysql.git/blob - mysqldumpslow-clusters.patch
- rel 3
[packages/mysql.git] / mysqldumpslow-clusters.patch
1 --- percona-server-5.6.20-68.0/scripts/mysqldumpslow.sh~        2014-08-29 10:58:05.000000000 +0300
2 +++ percona-server-5.6.20-68.0/scripts/mysqldumpslow.sh 2014-09-06 20:50:22.000000000 +0300
3 @@ -51,8 +51,33 @@
4  
5  $opt{'help'} and usage();
6  
7 +# find config file for first defined cluster
8 +sub get_defaults_file {
9 +       my $clusters_file = '/etc/mysql/clusters.conf';
10 +       return unless -f $clusters_file;
11 +
12 +       open(my $fh , "< $clusters_file") or return;
13 +       while (<$fh>) {
14 +               my ($config, $clusterdir) = m{^([^#]+)\s*=\s*(.+)$};
15 +               next unless $config;
16 +
17 +               if ($config !~ m{/}) {
18 +                       my $f = "/etc/mysql/$config";
19 +                       return $f if -f $f;
20 +
21 +                       my $f = "$clusterdir/$config";
22 +                       return $f if -f $f;
23 +               }
24 +               return $config;
25 +       }
26 +       close($fh) or die $!;
27 +       return undef;
28 +}
29 +
30  unless (@ARGV) {
31 -    my $defaults   = `my_print_defaults mysqld`;
32 +       my $defaults_file = get_defaults_file;
33 +       my $defaults_arg = "-c $defaults_file" if $defaults_file;
34 +   my $defaults   = `my_print_defaults $defaults_arg mysqld`;
35      my $basedir = ($defaults =~ m/--basedir=(.*)/)[0]
36         or die "Can't determine basedir from 'my_print_defaults mysqld' output: $defaults";
37      warn "basedir=$basedir\n" if $opt{v};
38 @@ -61,7 +86,7 @@
39      my $slowlog = ($defaults =~ m/--slow-query-log-file=(.*)/)[0];
40      if (!$datadir or $opt{i}) {
41         # determine the datadir from the instances section of /etc/my.cnf, if any
42 -       my $instances  = `my_print_defaults instances`;
43 +       my $instances  = `my_print_defaults $defaults_arg instances`;
44         die "Can't determine datadir from 'my_print_defaults mysqld' output: $defaults"
45             unless $instances;
46         my @instances = ($instances =~ m/^--(\w+)-/mg);
This page took 0.093482 seconds and 3 git commands to generate.