1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

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)
This commit is contained in:
Vladislav Vaintroub
2009-11-03 01:19:37 +01:00
parent e080080711
commit 2377eed362
5 changed files with 156 additions and 34 deletions

View File

@ -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() ) {