Below is the list of changes that have just been committed into a local
5.0 repository of matthias. When matthias does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1902 05/08/31 11:44:01 mleich@stripped +1 -0
Merge mleich@stripped:/home/bk/mysql-5.0
into three.local.lan:/home/matthias/Arbeit/mysql-5.0/src-C
mysql-test/mysql-test-run.pl
1.38 05/08/31 11:33:20 matthias@stripped +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: mleich
# Host: three.local.lan
# Root: /home/matthias/Arbeit/mysql-5.0/src-C/RESYNC
--- 1.37/mysql-test/mysql-test-run.pl 2005-08-26 20:19:23 +03:00
+++ 1.38/mysql-test/mysql-test-run.pl 2005-08-31 11:33:20 +03:00
@@ -178,6 +178,7 @@
our $exe_mysql_fix_system_tables;
our $exe_mysqltest;
our $exe_slave_mysqld;
+our $exe_im;
our $opt_bench= 0;
our $opt_small_bench= 0;
@@ -216,6 +217,8 @@
our $master; # Will be struct in C
our $slave;
+our $instance_manager;
+
our $opt_ndbcluster_port;
our $opt_ndbconnectstring;
@@ -309,6 +312,8 @@
sub stop_masters_slaves ();
sub stop_masters ();
sub stop_slaves ();
+sub im_start ($$);
+sub im_stop ($);
sub run_mysqltest ($);
sub usage ($);
@@ -461,6 +466,9 @@
my $opt_master_myport= 9306;
my $opt_slave_myport= 9308;
$opt_ndbcluster_port= 9350;
+ my $im_port= 9310;
+ my $im_mysqld1_port= 9312;
+ my $im_mysqld2_port= 9314;
# Read the command line
# Note: Keep list, and the order, in sync with usage at end of this file
@@ -487,6 +495,9 @@
'slave_port=i' => \$opt_slave_myport,
'ndbcluster_port=i' => \$opt_ndbcluster_port,
'manager-port=i' => \$opt_manager_port, # Currently not used
+ 'im-port=i' => \$im_port, # Instance Manager port.
+ 'im-mysqld1-port=i' => \$im_mysqld1_port, # Port of mysqld,
controlled by IM
+ 'im-mysqld2-port=i' => \$im_mysqld2_port, # Port of mysqld,
controlled by IM
# Test case authoring
'record' => \$opt_record,
@@ -769,6 +780,37 @@
$slave->[2]->{'path_myport'}= $opt_slave_myport + 2;
$slave->[2]->{'start_timeout'}= 300;
+ $instance_manager->{'path_err'}= "$opt_vardir/log/im.err";
+ $instance_manager->{'path_log'}= "$opt_vardir/log/im.log";
+ $instance_manager->{'path_pid'}= "$opt_vardir/run/im.pid";
+ $instance_manager->{'path_sock'}= "$opt_tmpdir/im.sock";
+ $instance_manager->{'port'}= $im_port;
+ $instance_manager->{'start_timeout'}= $master->[0]->{'start_timeout'};
+ $instance_manager->{'admin_login'}= 'im_admin';
+ $instance_manager->{'admin_password'}= 'im_admin_secret';
+ $instance_manager->{'admin_sha1'}= '*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295';
+ $instance_manager->{'password_file'}= "$opt_vardir/im.passwd";
+ $instance_manager->{'defaults_file'}= "$opt_vardir/im.cnf";
+
+ $instance_manager->{'instances'}->[0]->{'server_id'}= 1;
+ $instance_manager->{'instances'}->[0]->{'port'}= $im_mysqld1_port;
+ $instance_manager->{'instances'}->[0]->{'path_datadir'}=
+ "$opt_vardir/im_mysqld_1.data";
+ $instance_manager->{'instances'}->[0]->{'path_sock'}=
+ "$opt_vardir/mysqld_1.sock";
+ $instance_manager->{'instances'}->[0]->{'path_pid'}=
+ "$opt_vardir/mysqld_1.pid";
+
+ $instance_manager->{'instances'}->[1]->{'server_id'}= 2;
+ $instance_manager->{'instances'}->[1]->{'port'}= $im_mysqld2_port;
+ $instance_manager->{'instances'}->[1]->{'path_datadir'}=
+ "$opt_vardir/im_mysqld_2.data";
+ $instance_manager->{'instances'}->[1]->{'path_sock'}=
+ "$opt_vardir/mysqld_2.sock";
+ $instance_manager->{'instances'}->[1]->{'path_pid'}=
+ "$opt_vardir/mysqld_2.pid";
+ $instance_manager->{'instances'}->[1]->{'nonguarded'}= 1;
+
if ( $opt_extern )
{
$glob_use_running_server= 1;
@@ -804,6 +846,9 @@
$exe_mysqld= mtr_exe_exists ("$glob_basedir/sql/mysqld");
$path_language= mtr_path_exists("$glob_basedir/sql/share/english/");
$path_charsetsdir= mtr_path_exists("$glob_basedir/sql/share/charsets");
+
+ $exe_im= mtr_exe_exists(
+ "$glob_basedir/server-tools/instance-manager/mysqlmanager");
}
if ( $glob_use_embedded_server )
@@ -851,6 +896,8 @@
$exe_mysqld= mtr_exe_exists ("$glob_basedir/libexec/mysqld",
"$glob_basedir/bin/mysqld");
+ $exe_im= mtr_exe_exists("$glob_basedir/libexec/mysqlmanager",
+ "$glob_basedir/bin/mysqlmanager");
if ( $glob_use_embedded_server )
{
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest_embedded");
@@ -924,6 +971,11 @@
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
$ENV{'MYSQL_TCP_PORT'}= 3306;
+ $ENV{'IM_MYSQLD1_SOCK'}= $instance_manager->{instances}->[0]->{path_sock};
+ $ENV{'IM_MYSQLD1_PORT'}= $instance_manager->{instances}->[0]->{port};
+ $ENV{'IM_MYSQLD2_SOCK'}= $instance_manager->{instances}->[1]->{path_sock};
+ $ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
+
if ( $glob_cygwin_perl )
{
foreach my $key ('MYSQL_TEST_WINDIR','MASTER_MYSOCK')
@@ -1007,25 +1059,24 @@
# FIXME do we really need to create these all, or are they
# created for us when tables are created?
- rmtree("$master->[0]->{'path_myddir'}");
- mkpath("$master->[0]->{'path_myddir'}/mysql");
- mkpath("$master->[0]->{'path_myddir'}/test");
-
- rmtree("$master->[1]->{'path_myddir'}");
- mkpath("$master->[1]->{'path_myddir'}/mysql");
- mkpath("$master->[1]->{'path_myddir'}/test");
-
- rmtree("$slave->[0]->{'path_myddir'}");
- mkpath("$slave->[0]->{'path_myddir'}/mysql");
- mkpath("$slave->[0]->{'path_myddir'}/test");
-
- rmtree("$slave->[1]->{'path_myddir'}");
- mkpath("$slave->[1]->{'path_myddir'}/mysql");
- mkpath("$slave->[1]->{'path_myddir'}/test");
-
- rmtree("$slave->[2]->{'path_myddir'}");
- mkpath("$slave->[2]->{'path_myddir'}/mysql");
- mkpath("$slave->[2]->{'path_myddir'}/test");
+ my @data_dir_lst = (
+ $master->[0]->{'path_myddir'},
+ $master->[1]->{'path_myddir'},
+ $slave->[0]->{'path_myddir'},
+ $slave->[1]->{'path_myddir'},
+ $slave->[2]->{'path_myddir'});
+
+ foreach my $instance (@{$instance_manager->{'instances'}})
+ {
+ push (@data_dir_lst, $instance->{'path_datadir'});
+ }
+
+ foreach my $data_dir (@data_dir_lst)
+ {
+ rmtree("$data_dir");
+ mkpath("$data_dir/mysql");
+ mkpath("$data_dir/test");
+ }
# To make some old test cases work, we create a soft
# link from the old "var" location to the new one
@@ -1263,6 +1314,11 @@
install_db('slave', $slave->[1]->{'path_myddir'});
install_db('slave', $slave->[2]->{'path_myddir'});
+ if ( defined $exe_im)
+ {
+ im_prepare_env($instance_manager);
+ }
+
if ( ndbcluster_install() )
{
# failed to install, disable usage but flag that its no ok
@@ -1337,6 +1393,101 @@
}
+sub im_prepare_env($) {
+ my $instance_manager = shift;
+
+ im_create_passwd_file($instance_manager);
+ im_prepare_data_dir($instance_manager);
+}
+
+
+sub im_create_passwd_file($) {
+ my $instance_manager = shift;
+
+ my $pwd_file_path = $instance_manager->{'password_file'};
+
+ mtr_report("Creating IM password file ($pwd_file_path)");
+
+ open(OUT, ">", $pwd_file_path)
+ or mtr_error("Can't write to $pwd_file_path: $!");
+
+ print OUT $instance_manager->{'admin_login'}, ":",
+ $instance_manager->{'admin_sha1'}, "\n";
+
+ close(OUT);
+}
+
+
+sub im_create_defaults_file($) {
+ my $instance_manager = shift;
+
+ my $defaults_file = $instance_manager->{'defaults_file'};
+
+ open(OUT, ">", $defaults_file)
+ or mtr_error("Can't write to $defaults_file: $!");
+
+ print OUT <<EOF
+[mysql]
+
+[manager]
+pid-file = $instance_manager->{path_pid}
+socket = $instance_manager->{path_sock}
+port = $instance_manager->{port}
+password-file = $instance_manager->{password_file}
+default-mysqld-path = $exe_mysqld
+
+EOF
+;
+
+ foreach my $instance (@{$instance_manager->{'instances'}})
+ {
+ my $server_id = $instance->{'server_id'};
+
+ print OUT <<EOF
+[mysqld$server_id]
+socket = $instance->{path_sock}
+pid-file = $instance->{path_pid}
+port = $instance->{port}
+datadir = $instance->{path_datadir}
+log = $instance->{path_datadir}/mysqld$server_id.log
+log-error = $instance->{path_datadir}/mysqld$server_id.err.log
+log-slow-queries = $instance->{path_datadir}/mysqld$server_id.slow.log
+language = $path_language
+character-sets-dir = $path_charsetsdir
+basedir = $path_my_basedir
+server_id =$server_id
+skip-stack-trace
+skip-innodb
+skip-bdb
+skip-ndbcluster
+EOF
+;
+
+ if ( exists $instance->{nonguarded} and
+ defined $instance->{nonguarded} )
+ {
+ print OUT "nonguarded\n";
+ }
+
+ print OUT "\n";
+ }
+
+ close(OUT);
+}
+
+
+sub im_prepare_data_dir($) {
+ my $instance_manager = shift;
+
+ foreach my $instance (@{$instance_manager->{'instances'}})
+ {
+ install_db(
+ 'im_mysqld_' . $instance->{'server_id'},
+ $instance->{'path_datadir'});
+ }
+}
+
+
##############################################################################
#
# Run a single test case
@@ -1438,7 +1589,7 @@
# FIXME split up start and check that started so that can do
# starts in parallel, masters and slaves at the same time.
- if ( ! $opt_local_master )
+ if ( $tinfo->{'component_id'} eq 'mysqld' and ! $opt_local_master )
{
if ( $master->[0]->{'ndbcluster'} )
{
@@ -1477,6 +1628,17 @@
$master->[0]->{'running_master_is_special'}= 1;
}
}
+ elsif ( $tinfo->{'component_id'} eq 'im')
+ {
+ # We have to create defaults file every time, in order to ensure that it
+ # will be the same for each test. The problem is that test can change the
+ # file (by SET/UNSET commands), so w/o recreating the file, execution of
+ # one test can affect the other.
+
+ im_create_defaults_file($instance_manager);
+
+ im_start($instance_manager, $tinfo->{im_opts});
+ }
# ----------------------------------------------------------------------
# Start slaves - if needed
@@ -1559,6 +1721,15 @@
report_failure_and_restart($tinfo);
}
}
+
+ # ----------------------------------------------------------------------
+ # Stop Instance Manager if we are processing an IM-test case.
+ # ----------------------------------------------------------------------
+
+ if ( ! $glob_use_running_server and $tinfo->{'component_id'} eq 'im' )
+ {
+ im_stop($instance_manager);
+ }
}
@@ -1989,6 +2160,13 @@
sub stop_masters_slaves () {
print "Ending Tests\n";
+
+ if (defined $instance_manager->{'pid'})
+ {
+ print "Shutting-down Instance Manager\n";
+ im_stop($instance_manager);
+ }
+
print "Shutting-down MySQL daemon\n\n";
stop_masters();
print "Master(s) shutdown finished\n";
@@ -2047,6 +2225,97 @@
mtr_stop_mysqld_servers(\@args);
}
+##############################################################################
+#
+# Instance Manager management routines.
+#
+##############################################################################
+
+sub im_start($$) {
+ my $instance_manager = shift;
+ my $opts = shift;
+
+ if ( ! defined $exe_im)
+ {
+ return;
+ }
+
+ my $args;
+ mtr_init_args(\$args);
+ mtr_add_arg($args, "--defaults-file=" . $instance_manager->{'defaults_file'});
+
+ foreach my $opt (@{$opts})
+ {
+ mtr_add_arg($args, $opt);
+ }
+
+ $instance_manager->{'pid'} =
+ mtr_spawn(
+ $exe_im, # path to the executable
+ $args, # cmd-line args
+ '', # stdin
+ $instance_manager->{'path_log'}, # stdout
+ $instance_manager->{'path_err'}, # stderr
+ '', # pid file path (not used)
+ { append_log_file => 1 } # append log files
+ );
+
+ if ( ! defined $instance_manager->{'pid'} )
+ {
+ mtr_report('Could not start Instance Manager');
+ return;
+ }
+
+ # Instance Manager can be run in daemon mode. In this case, it creates
+ # several processes and the parent process, created by mtr_spawn(), exits just
+ # after start. So, we have to obtain Instance Manager PID from the PID file.
+
+ sleep_until_file_created(
+ $instance_manager->{'path_pid'},
+ $instance_manager->{'start_timeout'},
+ -1); # real PID is still unknown
+
+ $instance_manager->{'pid'} =
+ mtr_get_pid_from_file($instance_manager->{'path_pid'});
+}
+
+sub im_stop($) {
+ my $instance_manager = shift;
+
+ if (! defined $instance_manager->{'pid'})
+ {
+ return;
+ }
+
+ # Inspired from mtr_stop_mysqld_servers().
+
+ start_reap_all();
+
+ # Create list of pids. We should stop Instance Manager and all started
+ # mysqld-instances. Some of them may be nonguarded, so IM will not stop them
+ # on shutdown.
+
+ my @pids = ( $instance_manager->{'pid'} );
+ my $instances = $instance_manager->{'instances'};
+
+ if ( -r $instances->[0]->{'path_pid'} )
+ {
+ push @pids, mtr_get_pid_from_file($instances->[0]->{'path_pid'});
+ }
+
+ if ( -r $instances->[1]->{'path_pid'} )
+ {
+ push @pids, mtr_get_pid_from_file($instances->[1]->{'path_pid'});
+ }
+
+ # Kill processes.
+
+ mtr_kill_processes(\@pids);
+
+ stop_reap_all();
+
+ $instance_manager->{'pid'} = undef;
+}
sub run_mysqltest ($) {
my $tinfo= shift;
@@ -2070,7 +2339,9 @@
}
my $cmdline_mysqlbinlog=
- "$exe_mysqlbinlog --no-defaults --local-load=$opt_tmpdir
--character-sets-dir=$path_charsetsdir";
+ "$exe_mysqlbinlog" .
+ " --no-defaults --local-load=$opt_tmpdir" .
+ " --character-sets-dir=$path_charsetsdir";
if ( $opt_debug )
{
@@ -2128,15 +2399,26 @@
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'});
- mtr_add_arg($args, "--database=test");
- mtr_add_arg($args, "--user=%s", $opt_user);
- mtr_add_arg($args, "--password=");
mtr_add_arg($args, "--silent");
mtr_add_arg($args, "-v");
mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
- mtr_add_arg($args, "--port=%d", $master->[0]->{'path_myport'});
+
+ if ($tinfo->{'component_id'} eq 'im')
+ {
+ mtr_add_arg($args, "--socket=%s", $instance_manager->{'path_sock'});
+ mtr_add_arg($args, "--port=%d", $instance_manager->{'port'});
+ mtr_add_arg($args, "--user=%s", $instance_manager->{'admin_login'});
+ mtr_add_arg($args, "--password=%s", $instance_manager->{'admin_password'});
+ }
+ else # component_id == mysqld
+ {
+ mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'});
+ mtr_add_arg($args, "--port=%d", $master->[0]->{'path_myport'});
+ mtr_add_arg($args, "--database=test");
+ mtr_add_arg($args, "--user=%s", $opt_user);
+ mtr_add_arg($args, "--password=");
+ }
if ( $opt_ps_protocol )
{
@@ -2225,7 +2507,6 @@
ps-protocol Use the binary protocol between client and server
bench Run the benchmark suite FIXME
small-bench FIXME
- no-manager Use the istanse manager (currently disabled)
Options to control what test suites or cases to run
@@ -2242,7 +2523,6 @@
master_port=PORT Specify the port number used by the first master
slave_port=PORT Specify the port number used by the first slave
ndbcluster_port=PORT Specify the port number used by cluster
- manager-port=PORT Specify the port number used by manager (currently not used)
Options for test case authoring
| Thread |
|---|
| • bk commit into 5.0 tree (mleich:1.1902) | mleich | 31 Aug |