diff options
author | Vladislav Vaintroub <vvaintroub@mysql.com> | 2009-11-03 01:19:37 +0100 |
---|---|---|
committer | Vladislav Vaintroub <vvaintroub@mysql.com> | 2009-11-03 01:19:37 +0100 |
commit | 2377eed362f9b9b3c4a360d75f112ac2ac627539 (patch) | |
tree | 7efbc2b00daea46ee33727295265e0752f0385b4 /mysql-test/lib/My/ConfigFactory.pm | |
parent | e080080711793006e26104a44838e1e5de806c78 (diff) | |
download | mariadb-git-2377eed362f9b9b3c4a360d75f112ac2ac627539.tar.gz |
Bug #47423 mtr connects to wrong database
The reason for the bug is that mysqtest as well as other client tools
running in test suite (mysqlbinlog, mysqldump) will first try to connect
whatever database has created shared memory with default base name
"MySQL" and use this. (Same effect could be seen on Unix if mtr would
not care to calculate "port" and "socket" parameter).
The fix ensures that all client tools and running in mtr use unique
per-database shared memory base parameters, so there is no possibility
to clash with already installed one. We use socket name for shared memory
base (it's known to be unique). This shared-memory-base is written to the
MTR config file to the [client] and [mysqld] sections. Fix made also made
sure all client tools understand and correctly handle --shared-memory-base.
Prior to this patch it was not the case for mysqltest, mysqlbinlog and
mysql_client_test.
All new connections done from mtr scripts via connect() will by default
set shared-memory-base. And finally, there is a possibility to force
shared memory or pipe connection and overwrite shared memory/pipe base name
from within mtr scripts via optional PIPE or SHM modifier. This functionality
was manually backported from 6.0
(original patch http://lists.mysql.com/commits/74749)
Diffstat (limited to 'mysql-test/lib/My/ConfigFactory.pm')
-rw-r--r-- | mysql-test/lib/My/ConfigFactory.pm | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm index c1e8f7cd826..c4d68e7127c 100644 --- a/mysql-test/lib/My/ConfigFactory.pm +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -7,6 +7,7 @@ use Carp; use My::Config; use My::Find; +use My::Platform; use File::Basename; @@ -218,7 +219,13 @@ my @mysqld_rules= { 'ssl-key' => \&fix_ssl_server_key }, ); - +if (IS_WINDOWS) +{ + # For simplicity, we use the same names for shared memory and + # named pipes. + push(@mysqld_rules, {'shared-memory-base-name' => \&fix_socket}); +} + sub fix_ndb_mgmd_port { my ($self, $config, $group_name, $group)= @_; my $hostname= $group->value('HostName'); @@ -347,6 +354,16 @@ sub post_check_client_group { } $config->insert($client_group_name, $name_to, $option->value()) } + + if (IS_WINDOWS) + { + # Shared memory base may or may not be defined (e.g not defined in embedded) + my $shm = $group_to_copy_from->option("shared-memory-base-name"); + if (defined $shm) + { + $config->insert($client_group_name,"shared-memory-base-name", $shm->value()); + } + } } @@ -393,6 +410,7 @@ sub post_check_embedded_group { ( '#log-error', # Embedded server writes stderr to mysqltest's log file 'slave-net-timeout', # Embedded server are not build with replication + 'shared-memory-base-name', # No shared memory for embedded ); foreach my $option ( $mysqld->options(), $first_mysqld->options() ) { |