summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-12-05 15:25:15 +0100
committerSergei Golubchik <serg@mariadb.org>2015-12-07 15:20:23 +0100
commite05883bf305ff6f9b85288e11d1e9b7458bb924e (patch)
treeca8ade61ea2f1ff02830cf8276775e432483cf8f /scripts
parentef47b62551b0f37770e5d174ea028150c5b71fd8 (diff)
downloadmariadb-git-e05883bf305ff6f9b85288e11d1e9b7458bb924e.tar.gz
MDEV-7341 mysqld_multi doesn't recognize include directive (not following includes)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mysqld_multi.sh20
1 files changed, 14 insertions, 6 deletions
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index cd1b6fc18b7..2f67ff424b9 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -486,6 +486,7 @@ sub get_mysqladmin_options
# Return a list of option files which can be opened. Similar, but not
# identical, to behavior of my_search_option_files()
+# TODO implement and use my_print_defaults --list-groups instead
sub list_defaults_files
{
my %opt;
@@ -497,9 +498,7 @@ sub list_defaults_files
return ($opt{file}) if exists $opt{file};
- my %seen; # Don't list the same file more than once
- return grep { defined $_ and not $seen{$_}++ and -f $_ and -r $_ }
- ('/etc/my.cnf',
+ return ('/etc/my.cnf',
'/etc/mysql/my.cnf',
'@sysconfdir@/my.cnf',
($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef),
@@ -539,11 +538,12 @@ sub find_groups
}
}
+ my %seen;
my @defaults_files = list_defaults_files();
- #warn "@{[sort keys %gids]} -> @defaults_files\n";
- foreach my $file (@defaults_files)
+ while (@defaults_files)
{
- next unless open CONF, "< $file";
+ my $file = shift @defaults_files;
+ next unless defined $file and not $seen{$file}++ and open CONF, '<', $file;
while (<CONF>)
{
@@ -556,6 +556,14 @@ sub find_groups
push @groups, "$1$2";
}
}
+ elsif (/^\s*!include\s+(\S.*?)\s*$/)
+ {
+ push @defaults_files, $1;
+ }
+ elsif (/^\s*!includedir\s+(\S.*?)\s*$/)
+ {
+ push @defaults_files, <$1/*.cnf>;
+ }
}
close CONF;