1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-16 00:42:55 +03:00

Merge maint2.mysql.com:/data/localhome/tsmith/bk/g51

into  maint2.mysql.com:/data/localhome/tsmith/bk/51


client/mysqltest.c:
  Auto merged
configure.in:
  Auto merged
include/config-netware.h:
  Auto merged
include/mysql_com.h:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/lib/mtr_process.pl:
  Auto merged
mysql-test/r/func_time.result:
  Auto merged
mysql-test/r/grant.result:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Auto merged
mysql-test/r/partition.result:
  Auto merged
mysql-test/r/partition_mgm.result:
  Auto merged
mysql-test/t/disabled.def:
  Auto merged
mysql-test/t/func_time.test:
  Auto merged
mysql-test/t/grant.test:
  Auto merged
mysql-test/t/innodb_mysql.test:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_strfunc.h:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
storage/innobase/btr/btr0btr.c:
  Auto merged
storage/innobase/buf/buf0buf.c:
  Auto merged
storage/innobase/dict/dict0dict.c:
  Auto merged
storage/innobase/fil/fil0fil.c:
  Auto merged
storage/innobase/fsp/fsp0fsp.c:
  Auto merged
storage/innobase/include/btr0cur.ic:
  Auto merged
storage/innobase/include/buf0buf.ic:
  Auto merged
storage/innobase/log/log0log.c:
  Auto merged
storage/innobase/log/log0recv.c:
  Auto merged
storage/innobase/os/os0file.c:
  Auto merged
storage/innobase/row/row0sel.c:
  Auto merged
storage/innobase/srv/srv0start.c:
  Auto merged
storage/innobase/ut/ut0dbg.c:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
BUILD/check-cpu:
  Manual merge
storage/innobase/row/row0mysql.c:
  Manual merge
This commit is contained in:
unknown
2006-09-04 23:05:17 +02:00
73 changed files with 1722 additions and 1345 deletions

View File

@ -216,7 +216,7 @@ our $opt_embedded_server;
our $opt_extern;
our $opt_fast;
our $opt_force;
our $opt_reorder;
our $opt_reorder= 0;
our $opt_enable_disabled;
our $opt_gcov;
@ -258,6 +258,7 @@ our $opt_result_ext;
our $opt_skip;
our $opt_skip_rpl;
our $use_slaves;
our $use_innodb;
our $opt_skip_test;
our $opt_skip_im;
@ -357,9 +358,11 @@ sub run_benchmarks ($);
sub initialize_servers ();
sub mysql_install_db ();
sub install_db ($$);
sub copy_install_db ($$);
sub run_testcase ($);
sub run_testcase_stop_servers ($);
sub run_testcase_stop_servers ($$$);
sub run_testcase_start_servers ($);
sub run_testcase_check_skip_test($);
sub report_failure_and_restart ($);
sub do_before_start_master ($$);
sub do_before_start_slave ($$);
@ -424,6 +427,7 @@ sub main () {
$need_ndbcluster||= $test->{ndb_test};
$need_im||= $test->{component_id} eq 'im';
$use_slaves||= $test->{slave_num};
$use_innodb||= $test->{'innodb_test'};
}
$opt_skip_ndbcluster= $opt_skip_ndbcluster_slave= 1
unless $need_ndbcluster;
@ -1308,9 +1312,19 @@ sub executable_setup () {
}
sub generate_cmdline_mysqldump ($) {
my($mysqld) = @_;
return
"$exe_mysqldump --no-defaults -uroot " .
"--port=$mysqld->{'port'} " .
"--socket=$mysqld->{'path_sock'} --password=";
}
##############################################################################
#
# Set environment to be used by childs of this process
# Set environment to be used by childs of this process for
# things that are constant duting the whole lifetime of mysql-test-run.pl
#
##############################################################################
@ -1318,9 +1332,10 @@ sub executable_setup () {
sub environment_setup () {
my $extra_ld_library_paths;
umask(022);
my $extra_ld_library_paths;
# --------------------------------------------------------------------------
# Setup LD_LIBRARY_PATH so the libraries from this distro/clone
# are used in favor of the system installed ones
@ -1351,6 +1366,7 @@ sub environment_setup () {
# Also command lines in .opt files may contain env vars
# --------------------------------------------------------------------------
$ENV{'CHARSETSDIR'}= $path_charsetsdir;
$ENV{'UMASK'}= "0660"; # The octal *string*
$ENV{'UMASK_DIR'}= "0770"; # The octal *string*
$ENV{'LC_COLLATE'}= "C";
@ -1368,10 +1384,28 @@ sub environment_setup () {
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
$ENV{'MYSQL_TCP_PORT'}= 3306;
$ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
$ENV{'NDBCLUSTER_PORT_SLAVE'}=$opt_ndbcluster_port_slave;
$ENV{'NDB_STATUS_OK'}= "YES";
$ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
# ----------------------------------------------------
# Setup env for NDB
# ----------------------------------------------------
$ENV{'NDB_MGM'}= $exe_ndb_mgm;
$ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
$ENV{'NDBCLUSTER_PORT_SLAVE'}= $opt_ndbcluster_port_slave;
$ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test;
$ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'};
$ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
$ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
$ENV{'NDB_TOOLS_OUTPUT'}= $file_ndb_testrun_log;
$ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring;
# ----------------------------------------------------
# Setup env for IM
# ----------------------------------------------------
$ENV{'IM_EXE'}= $exe_im;
$ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
$ENV{'IM_PATH_ANGEL_PID'}= $instance_manager->{path_angel_pid};
@ -1386,9 +1420,174 @@ sub environment_setup () {
$ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
$ENV{'IM_MYSQLD2_PATH_PID'}=$instance_manager->{instances}->[1]->{path_pid};
$ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
# ----------------------------------------------------
# Setup env so childs can execute mysqlcheck
# ----------------------------------------------------
my $cmdline_mysqlcheck=
"$exe_mysqlcheck --no-defaults -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
if ( $opt_debug )
{
$cmdline_mysqlcheck .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlcheck.trace";
}
$ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
# ----------------------------------------------------
# Setup env to childs can execute myqldump
# ----------------------------------------------------
my $cmdline_mysqldump= generate_cmdline_mysqldump($master->[0]);
my $cmdline_mysqldumpslave= generate_cmdline_mysqldump($slave->[0]);
if ( $opt_debug )
{
$cmdline_mysqldump .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump-master.trace";
$cmdline_mysqldumpslave .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump-slave.trace";
}
$ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
$ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
# ----------------------------------------------------
# Setup env so childs can execute mysqlslap
# ----------------------------------------------------
unless ( $glob_win32 )
{
my $cmdline_mysqlslap=
"$exe_mysqlslap -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password= " .
"--lock-directory=$opt_tmpdir";
if ( $opt_debug )
{
$cmdline_mysqlslap .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlslap.trace";
}
$ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap;
}
# ----------------------------------------------------
# Setup env so childs can execute mysqlimport
# ----------------------------------------------------
my $cmdline_mysqlimport=
"$exe_mysqlimport -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
if ( $opt_debug )
{
$cmdline_mysqlimport .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlimport.trace";
}
$ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
# ----------------------------------------------------
# Setup env so childs can execute mysqlshow
# ----------------------------------------------------
my $cmdline_mysqlshow=
"$exe_mysqlshow -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
if ( $opt_debug )
{
$cmdline_mysqlshow .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlshow.trace";
}
$ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
# ----------------------------------------------------
# Setup env so childs can execute mysqlbinlog
# ----------------------------------------------------
my $cmdline_mysqlbinlog=
"$exe_mysqlbinlog" .
" --no-defaults --local-load=$opt_tmpdir" .
" --character-sets-dir=$path_charsetsdir";
if ( $opt_debug )
{
$cmdline_mysqlbinlog .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlbinlog.trace";
}
$ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
# ----------------------------------------------------
# Setup env so childs can execute mysql
# ----------------------------------------------------
my $cmdline_mysql=
"$exe_mysql --no-defaults --host=localhost --user=root --password= " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'}";
$ENV{'MYSQL'}= $cmdline_mysql;
# ----------------------------------------------------
# Setup env so childs can execute mysql_client_test
# ----------------------------------------------------
my $cmdline_mysql_client_test=
"$exe_mysql_client_test --no-defaults --testcase --user=root --silent " .
"--port=$master->[0]->{'port'} " .
"--vardir=$opt_vardir " .
"--socket=$master->[0]->{'path_sock'}";
if ( $opt_debug )
{
$cmdline_mysql_client_test .=
" --debug=d:t:A,$opt_vardir_trace/log/mysql_client_test.trace";
}
if ( $glob_use_embedded_server )
{
$cmdline_mysql_client_test.=
" -A --language=$path_language" .
" -A --datadir=$slave->[0]->{'path_myddir'}" .
" -A --character-sets-dir=$path_charsetsdir";
}
$ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test;
# ----------------------------------------------------
# Setup env so childs can execute mysql_fix_system_tables
# ----------------------------------------------------
my $cmdline_mysql_fix_system_tables=
"$exe_mysql_fix_system_tables --no-defaults --host=localhost --user=root --password= " .
"--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'}";
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
# ----------------------------------------------------
# Setup env so childs can execute my_print_defaults
# ----------------------------------------------------
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
# ----------------------------------------------------
# Setup env so childs can execute perror
# ----------------------------------------------------
$ENV{'MY_PERROR'}= $exe_perror;
# ----------------------------------------------------
# Add the path where mysqld will find udf_example.so
# ----------------------------------------------------
$ENV{'UDF_EXAMPLE_LIB'}=
($lib_udf_example ? basename($lib_udf_example) : "");
$ENV{'LD_LIBRARY_PATH'}=
($lib_udf_example ? dirname($lib_udf_example) : "") .
($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
# ----------------------------------------------------
# We are nice and report a bit about our settings
# ----------------------------------------------------
if (!$opt_extern)
{
print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n";
@ -1756,6 +1955,23 @@ sub mysqld_wait_started($){
}
sub ndb_mgmd_wait_started($) {
my ($cluster)= @_;
my $retries= 100;
while (ndbcluster_wait_started($cluster, "--no-contact") and
$retries)
{
# Millisceond sleep emulated with select
select(undef, undef, undef, (0.1));
$retries--;
}
return $retries == 0;
}
sub ndb_mgmd_start ($) {
my $cluster= shift;
@ -1776,13 +1992,12 @@ sub ndb_mgmd_start ($) {
"",
{ append_log_file => 1 });
# FIXME Should not be needed
# Unfortunately the cluster nodes will fail to start
# if ndb_mgmd has not started properly
while (ndbcluster_wait_started($cluster, "--no-contact"))
if (ndb_mgmd_wait_started($cluster))
{
select(undef, undef, undef, 0.1);
mtr_error("Failed to wait for start of ndb_mgmd");
}
# Remember pid of ndb_mgmd
@ -1847,7 +2062,7 @@ sub ndbcluster_start ($$) {
mtr_error("Cluster '$cluster->{'name'}' already started");
}
my $pid= ndb_mgmd_start($cluster);
ndb_mgmd_start($cluster);
for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
{
@ -1958,6 +2173,11 @@ sub run_suite () {
foreach my $tinfo ( @$tests )
{
if (run_testcase_check_skip_test($tinfo))
{
next;
}
mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout);
run_testcase($tinfo);
mtr_timer_stop($glob_timers,"testcase");
@ -2013,9 +2233,10 @@ sub initialize_servers () {
sub mysql_install_db () {
# FIXME not exactly true I think, needs improvements
install_db('master', $master->[0]->{'path_myddir'});
install_db('master', $master->[1]->{'path_myddir'});
# FIXME check if testcase really is using second master
copy_install_db('master', $master->[1]->{'path_myddir'});
if ( $use_slaves )
{
@ -2029,10 +2250,8 @@ sub mysql_install_db () {
im_prepare_env($instance_manager);
}
my $cluster_started_ok= 1; # Assume it can be started
if (ndbcluster_start_install($clusters->[0]) ||
$use_slaves && ndbcluster_start_install($clusters->[1]))
{
@ -2040,7 +2259,6 @@ sub mysql_install_db () {
$cluster_started_ok= 0;
}
foreach my $cluster (@{$clusters})
{
@ -2058,6 +2276,9 @@ sub mysql_install_db () {
}
}
$ENV{'NDB_STATUS_OK'}= $clusters->[0]->{'installed_ok'};
$ENV{'NDB_SLAVE_STATUS_OK'}= $clusters->[1]->{'installed_ok'};;
if ( ! $cluster_started_ok )
{
if ( $opt_force)
@ -2077,6 +2298,18 @@ sub mysql_install_db () {
}
sub copy_install_db ($$) {
my $type= shift;
my $data_dir= shift;
mtr_report("Installing \u$type Database");
# Just copy the installed db from first master
mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir);
}
sub install_db ($$) {
my $type= shift;
my $data_dir= shift;
@ -2231,12 +2464,92 @@ sub im_prepare_data_dir($) {
foreach my $instance (@{$instance_manager->{'instances'}})
{
install_db(
copy_install_db(
'im_mysqld_' . $instance->{'server_id'},
$instance->{'path_datadir'});
}
}
sub run_testcase_check_skip_test($)
{
my ($tinfo)= @_;
# ----------------------------------------------------------------------
# If marked to skip, just print out and return.
# Note that a test case not marked as 'skip' can still be
# skipped later, because of the test case itself in cooperation
# with the mysqltest program tells us so.
# ----------------------------------------------------------------------
if ( $tinfo->{'skip'} )
{
mtr_report_test_name($tinfo);
mtr_report_test_skipped($tinfo);
return 1;
}
# If test needs cluster, check that master installed ok
if ( $tinfo->{'ndb_test'} and $clusters->[0]->{'installed_ok'} eq "NO" )
{
mtr_report_test_name($tinfo);
mtr_report_test_failed($tinfo);
return 1;
}
# If test needs slave cluster, check that it installed ok
if ( $tinfo->{'ndb_test'} and $tinfo->{'slave_num'} and
$clusters->[1]->{'installed_ok'} eq "NO" )
{
mtr_report_test_name($tinfo);
mtr_report_test_failed($tinfo);
return 1;
}
return 0;
}
sub do_before_run_mysqltest($)
{
my $tinfo= shift;
my $tname= $tinfo->{'name'};
# Remove old reject file
if ( $opt_suite eq "main" )
{
unlink("r/$tname.reject");
}
else
{
unlink("suite/$opt_suite/r/$tname.reject");
}
# MASV cleanup...
mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
# output current test to ndbcluster log file to enable diagnostics
mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n");
mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
if ( $master->[1]->{'pid'} )
{
mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
}
}
sub do_after_run_mysqltest($)
{
my $tinfo= shift;
my $tname= $tinfo->{'name'};
#MASV cleanup
# Save info from this testcase run to mysqltest.log
my $testcase_log= mtr_fromfile($path_timefile) if -f $path_timefile;
mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n");
mtr_tofile($path_mysqltest_log, $testcase_log);
}
##############################################################################
#
@ -2257,100 +2570,35 @@ sub im_prepare_data_dir($) {
sub run_testcase ($) {
my $tinfo= shift;
my $tname= $tinfo->{'name'};
my $master_restart= run_testcase_need_master_restart($tinfo);
my $slave_restart= run_testcase_need_slave_restart($tinfo);
mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
# output current test to ndbcluster log file to enable diagnostics
mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n");
# ----------------------------------------------------------------------
# If marked to skip, just print out and return.
# Note that a test case not marked as 'skip' can still be
# skipped later, because of the test case itself in cooperation
# with the mysqltest program tells us so.
# ----------------------------------------------------------------------
if ( $tinfo->{'skip'} )
if ($master_restart or $slave_restart)
{
mtr_report_test_name($tinfo);
mtr_report_test_skipped($tinfo);
return;
run_testcase_stop_servers($tinfo, $master_restart, $slave_restart);
}
# If test needs cluster, check that master installed ok
if ( $tinfo->{'ndb_test'} and $clusters->[0]->{'installed_ok'} eq "NO" )
my $died= mtr_record_dead_children();
if ($died or $master_restart or $slave_restart)
{
mtr_report_test_name($tinfo);
mtr_report_test_failed($tinfo);
return;
run_testcase_start_servers($tinfo);
}
# If test needs slave cluster, check that it installed ok
if ( $tinfo->{'ndb_test'} and $tinfo->{'slave_num'} and
$clusters->[1]->{'installed_ok'} eq "NO" )
{
mtr_report_test_name($tinfo);
mtr_report_test_failed($tinfo);
return;
}
run_testcase_stop_servers($tinfo);
# ----------------------------------------------------------------------
# Prepare to start masters. Even if we use embedded, we want to run
# the preparation.
# ----------------------------------------------------------------------
$ENV{'TZ'}= $tinfo->{'timezone'};
mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
if ( $master->[1]->{'pid'} )
{
mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
}
# ----------------------------------------------------------------------
# If any mysqld servers running died, we have to know
# ----------------------------------------------------------------------
mtr_record_dead_children();
# ----------------------------------------------------------------------
# Start masters needed by the testcase
# ----------------------------------------------------------------------
run_testcase_start_servers($tinfo);
# ----------------------------------------------------------------------
# If --start-and-exit or --start-dirty given, stop here to let user manually
# run tests
# ----------------------------------------------------------------------
if ( $opt_start_and_exit or $opt_start_dirty )
{
mtr_report("\nServers started, exiting");
exit(0);
}
# ----------------------------------------------------------------------
# Run the test case
# ----------------------------------------------------------------------
mtr_report_test_name($tinfo);
{
# remove the old reject file
if ( $opt_suite eq "main" )
{
unlink("r/$tname.reject");
}
else
{
unlink("suite/$opt_suite/r/$tname.reject");
}
unlink($path_timefile);
do_before_run_mysqltest($tinfo);
my $res= run_mysqltest($tinfo);
mtr_report_test_name($tinfo);
if ( $res == 0 )
{
mtr_report_test_passed($tinfo);
@ -2362,7 +2610,8 @@ sub run_testcase ($) {
# Try to get reason from mysqltest.log
my $last_line= mtr_lastlinefromfile($path_timefile) if -f $path_timefile;
my $reason= mtr_match_prefix($last_line, "reason: ");
$tinfo->{'comment'}= defined $reason ? $reason : "Detected by testcase(reason unknown) ";
$tinfo->{'comment'}=
defined $reason ? $reason : "Detected by testcase(reason unknown) ";
mtr_report_test_skipped($tinfo);
}
elsif ( $res == 63 )
@ -2382,10 +2631,8 @@ sub run_testcase ($) {
report_failure_and_restart($tinfo);
}
# Save info from this testcase run to mysqltest.log
my $testcase_log= mtr_fromfile($path_timefile) if -f $path_timefile;
mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n");
mtr_tofile($path_mysqltest_log, $testcase_log);
do_after_run_mysqltest($tinfo);
}
# ----------------------------------------------------------------------
@ -2650,7 +2897,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--datadir=%s", $prefix,
$master->[$idx]->{'path_myddir'});
if ( $idx > 0 )
if ( $idx > 0 or !$use_innodb)
{
mtr_add_arg($args, "%s--skip-innodb", $prefix);
}
@ -2999,24 +3246,9 @@ sub stop_all_servers () {
}
# ----------------------------------------------------------------------
# If not using a running servers we may need to stop and restart.
# We restart in the case we have initiation scripts, server options
# etc to run. But we also restart again after the test first restart
# and test is run, to get back to normal server settings.
#
# To make the code a bit more clean, we actually only stop servers
# here, and mark this to be done. Then a generic "start" part will
# start up the needed servers again.
# ----------------------------------------------------------------------
sub run_testcase_stop_servers($) {
my $tinfo= shift;
if ( $glob_use_running_server || $glob_use_embedded_server )
{
return;
}
sub run_testcase_need_master_restart($)
{
my ($tinfo)= @_;
# We try to find out if we are to restart the master(s)
my $do_restart= 0; # Assumes we don't have to
@ -3073,6 +3305,91 @@ sub run_testcase_stop_servers($) {
join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
}
return $do_restart;
}
sub run_testcase_need_slave_restart($)
{
my ($tinfo)= @_;
# We try to find out if we are to restart the slaves
my $do_slave_restart= 0; # Assumes we don't have to
# FIXME only restart slave when necessary
$do_slave_restart= 1;
# if ( ! $slave->[0]->{'pid'} )
# {
# # mtr_verbose("Slave not started, no need to check slave restart");
# }
# elsif ( $do_restart )
# {
# $do_slave_restart= 1; # Always restart if master restart
# mtr_verbose("Restart slave because: Master restart");
# }
# elsif ( $tinfo->{'slave_sh'} )
# {
# $do_slave_restart= 1; # Always restart if script to run
# mtr_verbose("Restart slave because: Always restart if script to run");
# }
# elsif ( ! $opt_skip_ndbcluster_slave and
# $tinfo->{'ndb_test'} == 0 and
# $clusters->[1]->{'pid'} != 0 )
# {
# $do_slave_restart= 1; # Restart without slave cluster
# mtr_verbose("Restart slave because: Test does not need slave cluster");
# }
# elsif ( ! $opt_with_ndbcluster_slave and
# $tinfo->{'ndb_test'} == 1 and
# $clusters->[1]->{'pid'} == 0 )
# {
# $do_slave_restart= 1; # Restart with slave cluster
# mtr_verbose("Restart slave because: Test need slave cluster");
# }
# elsif ( $tinfo->{'slave_restart'} )
# {
# $do_slave_restart= 1;
# mtr_verbose("Restart slave because: slave_restart");
# }
# elsif ( $slave->[0]->{'running_slave_is_special'} )
# {
# $do_slave_restart= 1;
# mtr_verbose("Restart slave because: running_slave_is_special");
# }
# # Check that running slave was started with same options
# # as the current test requires
# elsif (! mtr_same_opts($slave->[0]->{'start_opts'},
# $tinfo->{'slave_opt'}) )
# {
# $do_slave_restart= 1;
# mtr_verbose("Restart slave because: running with different options '" .
# join(" ", @{$tinfo->{'slave_opt'}}) . "' != '" .
# join(" ", @{$slave->[0]->{'start_opts'}}) . "'" );
# }
return $do_slave_restart;
}
# ----------------------------------------------------------------------
# If not using a running servers we may need to stop and restart.
# We restart in the case we have initiation scripts, server options
# etc to run. But we also restart again after the test first restart
# and test is run, to get back to normal server settings.
#
# To make the code a bit more clean, we actually only stop servers
# here, and mark this to be done. Then a generic "start" part will
# start up the needed servers again.
# ----------------------------------------------------------------------
sub run_testcase_stop_servers($$$) {
my ($tinfo, $do_restart, $do_slave_restart)= @_;
if ( $glob_use_running_server || $glob_use_embedded_server )
{
return;
}
my $pid;
my %admin_pids; # hash of admin processes that requests shutdown
my @kill_pids; # list of processes to shutdown/kill
@ -3130,62 +3447,7 @@ sub run_testcase_stop_servers($) {
}
}
# We try to find out if we are to restart the slaves
my $do_slave_restart= 0; # Assumes we don't have to
# FIXME only restaret when necessary
$do_slave_restart= 1;
# if ( ! $slave->[0]->{'pid'} )
# {
# # mtr_verbose("Slave not started, no need to check slave restart");
# }
# elsif ( $do_restart )
# {
# $do_slave_restart= 1; # Always restart if master restart
# mtr_verbose("Restart slave because: Master restart");
# }
# elsif ( $tinfo->{'slave_sh'} )
# {
# $do_slave_restart= 1; # Always restart if script to run
# mtr_verbose("Restart slave because: Always restart if script to run");
# }
# elsif ( ! $opt_skip_ndbcluster_slave and
# $tinfo->{'ndb_test'} == 0 and
# $clusters->[1]->{'pid'} != 0 )
# {
# $do_slave_restart= 1; # Restart without slave cluster
# mtr_verbose("Restart slave because: Test does not need slave cluster");
# }
# elsif ( ! $opt_with_ndbcluster_slave and
# $tinfo->{'ndb_test'} == 1 and
# $clusters->[1]->{'pid'} == 0 )
# {
# $do_slave_restart= 1; # Restart with slave cluster
# mtr_verbose("Restart slave because: Test need slave cluster");
# }
# elsif ( $tinfo->{'slave_restart'} )
# {
# $do_slave_restart= 1;
# mtr_verbose("Restart slave because: slave_restart");
# }
# elsif ( $slave->[0]->{'running_slave_is_special'} )
# {
# $do_slave_restart= 1;
# mtr_verbose("Restart slave because: running_slave_is_special");
# }
# # Check that running slave was started with same options
# # as the current test requires
# elsif (! mtr_same_opts($slave->[0]->{'start_opts'},
# $tinfo->{'slave_opt'}) )
# {
# $do_slave_restart= 1;
# mtr_verbose("Restart slave because: running with different options '" .
# join(" ", @{$tinfo->{'slave_opt'}}) . "' != '" .
# join(" ", @{$slave->[0]->{'start_opts'}}) . "'" );
# }
if ( $do_slave_restart )
if ( $do_restart || $do_slave_restart )
{
delete $slave->[0]->{'running_slave_is_special'}; # Forget history
@ -3439,136 +3701,9 @@ sub run_check_testcase ($$) {
}
sub generate_cmdline_mysqldump ($) {
my($info) = @_;
return
"$exe_mysqldump --no-defaults -uroot " .
"--port=$info->[0]->{'port'} " .
"--socket=$info->[0]->{'path_sock'} --password=";
}
sub run_mysqltest ($) {
my $tinfo= shift;
my $cmdline_mysqlcheck= "$exe_mysqlcheck --no-defaults -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
if ( $opt_debug )
{
$cmdline_mysqlcheck .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlcheck.trace";
}
my $cmdline_mysqldump= generate_cmdline_mysqldump $master;
my $cmdline_mysqldumpslave= generate_cmdline_mysqldump $slave;
if ( $opt_debug )
{
$cmdline_mysqldump .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump-master.trace";
$cmdline_mysqldumpslave .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump-slave.trace";
}
my $cmdline_mysqlslap;
unless ( $glob_win32 )
{
$cmdline_mysqlslap= "$exe_mysqlslap -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password= " .
"--lock-directory=$opt_tmpdir";
if ( $opt_debug )
{
$cmdline_mysqlslap .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlslap.trace";
}
}
my $cmdline_mysqlimport= "$exe_mysqlimport -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
if ( $opt_debug )
{
$cmdline_mysqlimport .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlimport.trace";
}
my $cmdline_mysqlshow= "$exe_mysqlshow -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
if ( $opt_debug )
{
$cmdline_mysqlshow .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlshow.trace";
}
my $cmdline_mysqlbinlog=
"$exe_mysqlbinlog" .
" --no-defaults --local-load=$opt_tmpdir" .
" --character-sets-dir=$path_charsetsdir";
if ( $opt_debug )
{
$cmdline_mysqlbinlog .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlbinlog.trace";
}
my $cmdline_mysql=
"$exe_mysql --no-defaults --host=localhost --user=root --password= " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'}";
my $cmdline_mysql_client_test=
"$exe_mysql_client_test --no-defaults --testcase --user=root --silent " .
"--port=$master->[0]->{'port'} " .
"--vardir=$opt_vardir " .
"--socket=$master->[0]->{'path_sock'}";
if ( $opt_debug )
{
$cmdline_mysql_client_test .=
" --debug=d:t:A,$opt_vardir_trace/log/mysql_client_test.trace";
}
if ( $glob_use_embedded_server )
{
$cmdline_mysql_client_test.=
" -A --language=$path_language" .
" -A --datadir=$slave->[0]->{'path_myddir'}" .
" -A --character-sets-dir=$path_charsetsdir";
}
my $cmdline_mysql_fix_system_tables=
"$exe_mysql_fix_system_tables --no-defaults --host=localhost --user=root --password= " .
"--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'}";
$ENV{'MYSQL'}= $cmdline_mysql;
$ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
$ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
$ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap unless $glob_win32;
$ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
$ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
$ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
$ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
$ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test;
$ENV{'CHARSETSDIR'}= $path_charsetsdir;
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
$ENV{'UDF_EXAMPLE_LIB'}=
($lib_udf_example ? basename($lib_udf_example) : "");
$ENV{'MY_PERROR'}= $exe_perror;
$ENV{'NDB_STATUS_OK'}= $clusters->[0]->{'installed_ok'};
$ENV{'NDB_SLAVE_STATUS_OK'}= $clusters->[0]->{'installed_ok'};;
$ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test;
$ENV{'NDB_MGM'}= $exe_ndb_mgm;
$ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'};
$ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
$ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
$ENV{'NDB_TOOLS_OUTPUT'}= $file_ndb_testrun_log;
$ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring;
my ($tinfo)= @_;
my $exe= $exe_mysqltest;
my $args;
@ -3647,7 +3782,8 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir_trace);
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace",
$opt_vardir_trace);
}
if ( $opt_ssl_supported )
@ -3660,9 +3796,9 @@ sub run_mysqltest ($) {
$glob_mysql_test_dir);
}
# Turn on SSL for all test cases
if ( $opt_ssl )
{
# Turn on SSL for _all_ test cases if option --ssl was used
mtr_add_arg($args, "--ssl",
$glob_mysql_test_dir);
}
@ -3744,6 +3880,11 @@ sub run_mysqltest ($) {
}
}
# -------------------------------------------------------
# Init variables that change for each testcase
# -------------------------------------------------------
$ENV{'TZ'}= $tinfo->{'timezone'};
my $res = mtr_run_test($exe,$args,"","",$path_timefile,"");
if ( $opt_check_testcases )