Commit 75de30a3 authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

Merge neptunus.(none):/home/msvensson/mysql/work/my50-work

into  neptunus.(none):/home/msvensson/mysql/work/my51-work
parents d1d93f74 6de56b75
...@@ -708,7 +708,7 @@ sub mtr_wait_blocking($) { ...@@ -708,7 +708,7 @@ sub mtr_wait_blocking($) {
} }
} }
# Start "mysqladmin shutdown" for a specific mysqld # Start "mysqladmin <command>" for a specific mysqld
sub mtr_mysqladmin_start($$$) { sub mtr_mysqladmin_start($$$) {
my $srv= shift; my $srv= shift;
my $command= shift; my $command= shift;
...@@ -738,9 +738,8 @@ sub mtr_mysqladmin_start($$$) { ...@@ -738,9 +738,8 @@ sub mtr_mysqladmin_start($$$) {
# Shutdown time must be high as slave may be in reconnect # Shutdown time must be high as slave may be in reconnect
mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo"); mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo");
mtr_add_arg($args, "$command"); mtr_add_arg($args, "$command");
my $path_mysqladmin_log= "$::opt_vardir/log/mysqladmin.log";
my $pid= mtr_spawn($::exe_mysqladmin, $args, my $pid= mtr_spawn($::exe_mysqladmin, $args,
"", $path_mysqladmin_log, $path_mysqladmin_log, "", "", "", "", "",
{ append_log_file => 1 }); { append_log_file => 1 });
mtr_verbose("mtr_mysqladmin_start, pid: $pid"); mtr_verbose("mtr_mysqladmin_start, pid: $pid");
return $pid; return $pid;
......
...@@ -94,10 +94,14 @@ sub mtr_report_test_skipped ($) { ...@@ -94,10 +94,14 @@ sub mtr_report_test_skipped ($) {
{ {
print "[ disabled ] $tinfo->{'comment'}\n"; print "[ disabled ] $tinfo->{'comment'}\n";
} }
else elsif ( $tinfo->{'comment'} )
{ {
print "[ skipped ] $tinfo->{'comment'}\n"; print "[ skipped ] $tinfo->{'comment'}\n";
} }
else
{
print "[ skipped ]\n";
}
} }
sub mtr_report_tests_not_skipped_though_disabled ($) { sub mtr_report_tests_not_skipped_though_disabled ($) {
......
...@@ -66,7 +66,6 @@ use IO::Socket::INET; ...@@ -66,7 +66,6 @@ use IO::Socket::INET;
use Data::Dumper; use Data::Dumper;
use strict; use strict;
use warnings; use warnings;
use diagnostics;
select(STDOUT); select(STDOUT);
$| = 1; # Automatically flush STDOUT $| = 1; # Automatically flush STDOUT
...@@ -311,11 +310,12 @@ my $source_dist= 0; ...@@ -311,11 +310,12 @@ my $source_dist= 0;
sub main (); sub main ();
sub initial_setup (); sub initial_setup ();
sub command_line_setup (); sub command_line_setup ();
sub datadir_setup (); sub datadir_list_setup ();
sub executable_setup (); sub executable_setup ();
sub environment_setup (); sub environment_setup ();
sub kill_running_servers (); sub kill_running_servers ();
sub cleanup_stale_files (); sub remove_stale_vardir ();
sub setup_vardir ();
sub check_ssl_support ($); sub check_ssl_support ($);
sub check_running_as_root(); sub check_running_as_root();
sub check_ndbcluster_support ($); sub check_ndbcluster_support ($);
...@@ -1201,6 +1201,7 @@ sub command_line_setup () { ...@@ -1201,6 +1201,7 @@ sub command_line_setup () {
# Setup master->[0] with the settings for the extern server # Setup master->[0] with the settings for the extern server
$master->[0]->{'path_sock'}= $opt_socket if $opt_socket; $master->[0]->{'path_sock'}= $opt_socket if $opt_socket;
mtr_report("Using extern server at '$master->[0]->{path_sock}'");
} }
else else
{ {
...@@ -1216,7 +1217,7 @@ sub command_line_setup () { ...@@ -1216,7 +1217,7 @@ sub command_line_setup () {
$path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/"; $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/";
} }
sub datadir_setup () { sub datadir_list_setup () {
# Make a list of all data_dirs # Make a list of all data_dirs
@data_dir_lst = ( @data_dir_lst = (
...@@ -1676,6 +1677,7 @@ sub environment_setup () { ...@@ -1676,6 +1677,7 @@ sub environment_setup () {
$ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'}; $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'};
$ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'}; $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'};
$ENV{'MYSQL_TCP_PORT'}= $mysqld_variables{'port'}; $ENV{'MYSQL_TCP_PORT'}= $mysqld_variables{'port'};
$ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'};
$ENV{'IM_PATH_SOCK'}= $instance_manager->{path_sock}; $ENV{'IM_PATH_SOCK'}= $instance_manager->{path_sock};
$ENV{'IM_USERNAME'}= $instance_manager->{admin_login}; $ENV{'IM_USERNAME'}= $instance_manager->{admin_login};
...@@ -1975,29 +1977,24 @@ sub kill_running_servers () { ...@@ -1975,29 +1977,24 @@ sub kill_running_servers () {
# This is different from terminating processes we have # This is different from terminating processes we have
# started from this run of the script, this is terminating # started from this run of the script, this is terminating
# leftovers from previous runs. # leftovers from previous runs.
if ( ! -d $opt_vardir )
{
if ( -l $opt_vardir and ! -d readlink($opt_vardir) )
{
mtr_report("Removing $opt_vardir symlink without destination");
unlink($opt_vardir);
}
# The "var" dir does not exist already
# the processes that mtr_kill_leftovers start will write
# their log files to var/log so it should be created
mkpath("$opt_vardir/log");
}
mtr_kill_leftovers(); mtr_kill_leftovers();
} }
} }
sub cleanup_stale_files () {
my $created_by_mem_file= "$glob_mysql_test_dir/var/created_by_mem"; #
# Remove var and any directories in var/ created by previous
# tests
#
sub remove_stale_vardir () {
mtr_report("Removing Stale Files"); mtr_report("Removing Stale Files");
# Safety!
mtr_error("No, don't remove the vardir when running with --extern")
if $opt_extern;
mtr_verbose("opt_vardir: $opt_vardir");
if ( $opt_vardir eq $default_vardir ) if ( $opt_vardir eq $default_vardir )
{ {
# #
...@@ -2006,29 +2003,48 @@ sub cleanup_stale_files () { ...@@ -2006,29 +2003,48 @@ sub cleanup_stale_files () {
if ( -l $opt_vardir) if ( -l $opt_vardir)
{ {
# var is a symlink # var is a symlink
if (-f $created_by_mem_file)
if ( $opt_mem and readlink($opt_vardir) eq $opt_mem )
{ {
# Remove the directory which the link points at # Remove the directory which the link points at
mtr_verbose("Removing " . readlink($opt_vardir));
rmtree(readlink($opt_vardir)); rmtree(readlink($opt_vardir));
# Remove the entire "var" dir
rmtree("$opt_vardir/");
# Remove the "var" symlink # Remove the "var" symlink
mtr_verbose("unlink($opt_vardir)");
unlink($opt_vardir);
}
elsif ( $opt_mem )
{
# Just remove the "var" symlink
mtr_report("WARNING: Removing '$opt_vardir' symlink it's wrong");
mtr_verbose("unlink($opt_vardir)");
unlink($opt_vardir); unlink($opt_vardir);
} }
else else
{ {
# Some users creates a soft link in mysql-test/var to another area # Some users creates a soft link in mysql-test/var to another area
# - allow it # - allow it, but remove all files in it
mtr_report("WARNING: Using the 'mysql-test/var' symlink"); mtr_report("WARNING: Using the 'mysql-test/var' symlink");
rmtree("$opt_vardir/log");
rmtree("$opt_vardir/ndbcluster-$opt_ndbcluster_port"); # Make sure the directory where it points exist
rmtree("$opt_vardir/run"); mtr_error("The destination for symlink $opt_vardir does not exist")
rmtree("$opt_vardir/tmp"); if ! -d readlink($opt_vardir);
my $dir= shift;
foreach my $bin ( glob("$opt_vardir/*") )
{
mtr_verbose("Removing bin $bin");
rmtree($bin);
}
} }
} }
else else
{ {
# Remove the entire "var" dir # Remove the entire "var" dir
mtr_verbose("Removing $opt_vardir/");
rmtree("$opt_vardir/"); rmtree("$opt_vardir/");
} }
} }
...@@ -2040,21 +2056,43 @@ sub cleanup_stale_files () { ...@@ -2040,21 +2056,43 @@ sub cleanup_stale_files () {
# Remove the var/ dir in mysql-test dir if any # Remove the var/ dir in mysql-test dir if any
# this could be an old symlink that shouldn't be there # this could be an old symlink that shouldn't be there
mtr_verbose("Removing $default_vardir");
rmtree($default_vardir); rmtree($default_vardir);
# Remove the "var" dir # Remove the "var" dir
mtr_verbose("Removing $opt_vardir/");
rmtree("$opt_vardir/"); rmtree("$opt_vardir/");
} }
}
#
# Create var and the directories needed in var
#
sub setup_vardir() {
mtr_report("Creating Directories");
if ( $opt_mem ) if ( $opt_vardir eq $default_vardir )
{ {
# Runinng with var as a link to some "memory" location, normally tmpfs #
rmtree($opt_mem); # Running with "var" in mysql-test dir
mkpath($opt_mem); #
mtr_report("Creating symlink from $opt_vardir to $opt_mem"); if ( -l $opt_vardir )
symlink($opt_mem, $opt_vardir); {
# Put a small file to recognize this dir was created by --mem # it's a symlink
mtr_tofile($created_by_mem_file, $opt_mem);
# Make sure the directory where it points exist
mtr_error("The destination for symlink $opt_vardir does not exist")
if ! -d readlink($opt_vardir);
}
elsif ( $opt_mem )
{
# Runinng with "var" as a link to some "memory" location, normally tmpfs
mtr_verbose("Creating $opt_mem");
mkpath($opt_mem);
mtr_report("Symlinking 'var' to '$opt_mem'");
symlink($opt_mem, $opt_vardir);
}
} }
mkpath("$opt_vardir/log"); mkpath("$opt_vardir/log");
...@@ -2062,10 +2100,9 @@ sub cleanup_stale_files () { ...@@ -2062,10 +2100,9 @@ sub cleanup_stale_files () {
mkpath("$opt_vardir/tmp"); mkpath("$opt_vardir/tmp");
mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp"; mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp";
# Remove old and create new data dirs # Create new data dirs
foreach my $data_dir (@data_dir_lst) foreach my $data_dir (@data_dir_lst)
{ {
rmtree("$data_dir");
mkpath("$data_dir/mysql"); mkpath("$data_dir/mysql");
mkpath("$data_dir/test"); mkpath("$data_dir/test");
} }
...@@ -2602,23 +2639,41 @@ sub run_suite () { ...@@ -2602,23 +2639,41 @@ sub run_suite () {
sub initialize_servers () { sub initialize_servers () {
datadir_setup(); datadir_list_setup();
if ( ! $opt_extern ) if ( $opt_extern )
{
# Running against an already started server, if the specified
# vardir does not already exist it should be created
if ( ! -d $opt_vardir )
{
mtr_report("Creating '$opt_vardir'");
setup_vardir();
}
else
{
mtr_report("No need to create '$opt_vardir' it already exists");
}
}
else
{ {
kill_running_servers(); kill_running_servers();
if ( ! $opt_start_dirty ) if ( ! $opt_start_dirty )
{ {
cleanup_stale_files(); remove_stale_vardir();
setup_vardir();
mysql_install_db(); mysql_install_db();
if ( $opt_force ) if ( $opt_force )
{ {
# Save a snapshot of the freshly installed db
# to make it possible to restore to a known point in time
save_installed_db(); save_installed_db();
} }
} }
check_running_as_root();
} }
check_running_as_root();
} }
sub mysql_install_db () { sub mysql_install_db () {
...@@ -3487,6 +3542,12 @@ sub mysqld_arguments ($$$$$) { ...@@ -3487,6 +3542,12 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
} }
} }
if ( $mysql_version_id <= 50106 )
{
# Force mysqld to use log files up until 5.1.6
mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'});
}
} }
if ( $type eq 'slave' ) if ( $type eq 'slave' )
...@@ -3504,8 +3565,6 @@ sub mysqld_arguments ($$$$$) { ...@@ -3504,8 +3565,6 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--log-slave-updates", $prefix); mtr_add_arg($args, "%s--log-slave-updates", $prefix);
} }
mtr_add_arg($args, "%s--log=%s", $prefix,
$slave->[$idx]->{'path_mylog'});
mtr_add_arg($args, "%s--master-retry-count=10", $prefix); mtr_add_arg($args, "%s--master-retry-count=10", $prefix);
mtr_add_arg($args, "%s--pid-file=%s", $prefix, mtr_add_arg($args, "%s--pid-file=%s", $prefix,
$slave->[$idx]->{'path_pid'}); $slave->[$idx]->{'path_pid'});
...@@ -3566,6 +3625,13 @@ sub mysqld_arguments ($$$$$) { ...@@ -3566,6 +3625,13 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
} }
} }
if ( $mysql_version_id <= 50106 )
{
# Force mysqld to use log files up until 5.1.6
mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'});
}
} # end slave } # end slave
if ( $opt_debug ) if ( $opt_debug )
...@@ -3642,7 +3708,6 @@ sub mysqld_arguments ($$$$$) { ...@@ -3642,7 +3708,6 @@ sub mysqld_arguments ($$$$$) {
elsif ( $type eq 'master' ) elsif ( $type eq 'master' )
{ {
mtr_add_arg($args, "%s--open-files-limit=1024", $prefix); mtr_add_arg($args, "%s--open-files-limit=1024", $prefix);
mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'});
} }
return $args; return $args;
...@@ -4803,7 +4868,7 @@ Options that pass on options ...@@ -4803,7 +4868,7 @@ Options that pass on options
Options to run test on running server Options to run test on running server
extern Use running server for tests FIXME DANGEROUS extern Use running server for tests
ndb-connectstring=STR Use running cluster, and connect using STR ndb-connectstring=STR Use running cluster, and connect using STR
ndb-connectstring-slave=STR Use running slave cluster, and connect using STR ndb-connectstring-slave=STR Use running slave cluster, and connect using STR
user=USER User for connection to extern server user=USER User for connection to extern server
......
...@@ -8,7 +8,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File ...@@ -8,7 +8,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
change master to master_host='127.0.0.1'; change master to master_host='127.0.0.1';
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 test MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No # # 127.0.0.1 test DEFAULT_MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No #
change master to master_host='127.0.0.1',master_user='root', change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT; master_password='',master_port=MASTER_PORT;
show slave status; show slave status;
......
...@@ -18,7 +18,7 @@ show slave status; ...@@ -18,7 +18,7 @@ show slave status;
change master to master_host='127.0.0.1'; change master to master_host='127.0.0.1';
# The following needs to be cleaned up when change master is fixed # The following needs to be cleaned up when change master is fixed
--replace_result $MYSQL_TCP_PORT MASTER_PORT --replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 8 # 9 # 23 # 33 #
show slave status; show slave status;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment