Commit a2a69c54 authored by unknown's avatar unknown

Merge pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-rpl

into  pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-maint2


mysql-test/lib/mtr_cases.pm:
  Auto merged
mysql-test/mysql-test-run.pl:
  Manual merge
parents 4d8df716 c4dada6b
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
--source include/master-slave.inc --source include/master-slave.inc
# #
# Set up circular ring by schema A->B->C-D->A # Set up circular ring by schema A->B->C->D->A
# #
--connection slave --connection slave
......
...@@ -416,7 +416,7 @@ sub post_fix_mysql_cluster_section { ...@@ -416,7 +416,7 @@ sub post_fix_mysql_cluster_section {
# Add a [mysl_cluster.<suffix>] section for each # Add a [mysl_cluster.<suffix>] section for each
# defined [cluster_config.<suffix>] section # defined [cluster_config.<suffix>] section
foreach my $group ( $config->like('cluster_config\.\w*') ) foreach my $group ( $config->like('cluster_config\.\w*$') )
{ {
my @urls; my @urls;
# Generate ndb_connectstring for this cluster # Generate ndb_connectstring for this cluster
...@@ -497,7 +497,7 @@ sub run_generate_sections_from_cluster_config { ...@@ -497,7 +497,7 @@ sub run_generate_sections_from_cluster_config {
my @options= ('ndb_mgmd', 'ndbd', my @options= ('ndb_mgmd', 'ndbd',
'mysqld', 'ndbapi'); 'mysqld', 'ndbapi');
foreach my $group ( $config->like('cluster_config\.\w*') ) { foreach my $group ( $config->like('cluster_config\.\w*$') ) {
# Keep track of current index per process type # Keep track of current index per process type
my %idxes; my %idxes;
...@@ -580,7 +580,7 @@ sub new_config { ...@@ -580,7 +580,7 @@ sub new_config {
$self->run_section_rules($config, $self->run_section_rules($config,
'cluster_config\.\w*', 'cluster_config\.\w*$',
@cluster_config_rules); @cluster_config_rules);
$self->run_generate_sections_from_cluster_config($config); $self->run_generate_sections_from_cluster_config($config);
......
...@@ -721,6 +721,16 @@ sub collect_one_test_case { ...@@ -721,6 +721,16 @@ sub collect_one_test_case {
# Add slave opts, list of extra option only for slave # Add slave opts, list of extra option only for slave
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
process_opts_file($tinfo, "$testdir/$tname-slave.opt", 'slave_opt'); process_opts_file($tinfo, "$testdir/$tname-slave.opt", 'slave_opt');
#-----------------------------------------------------------------------
# Check for test specific config file
#-----------------------------------------------------------------------
my $test_cnf_file= "$testdir/$tname.cnf";
if ( -f $test_cnf_file) {
# Specifies the configuration file to use for this test
$tinfo->{'template_path'}= $test_cnf_file;
}
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Check for test specific config file # Check for test specific config file
......
...@@ -196,9 +196,12 @@ our %mysqld_variables; ...@@ -196,9 +196,12 @@ our %mysqld_variables;
my $source_dist= 0; my $source_dist= 0;
our $opt_max_save_core= 5; my $opt_max_save_core= $ENV{MTR_MAX_SAVE_CORE} || 5;
my $num_saved_cores= 0; # Number of core files saved in vardir/log/ so far. my $num_saved_cores= 0; # Number of core files saved in vardir/log/ so far.
my $opt_max_save_datadir= $ENV{MTR_MAX_SAVE_DATADIR} || 20;
my $num_saved_datadir= 0; # Number of datadirs saved in vardir/log/ so far.
select(STDOUT); select(STDOUT);
$| = 1; # Automatically flush STDOUT $| = 1; # Automatically flush STDOUT
...@@ -641,6 +644,7 @@ sub command_line_setup { ...@@ -641,6 +644,7 @@ sub command_line_setup {
'client-debugger=s' => \$opt_client_debugger, 'client-debugger=s' => \$opt_client_debugger,
'strace-client:s' => \$opt_strace_client, 'strace-client:s' => \$opt_strace_client,
'max-save-core=i' => \$opt_max_save_core, 'max-save-core=i' => \$opt_max_save_core,
'max-save-datadir=i' => \$opt_max_save_datadir,
# Coverage, profiling etc # Coverage, profiling etc
'gcov' => \$opt_gcov, 'gcov' => \$opt_gcov,
...@@ -2567,6 +2571,10 @@ sub run_testcase ($) { ...@@ -2567,6 +2571,10 @@ sub run_testcase ($) {
if ( started(all_servers()) == 0 ) if ( started(all_servers()) == 0 )
{ {
# Remove old datadirs
clean_datadir();
# Restore old ENV # Restore old ENV
while (my ($option, $value)= each( %old_env )) { while (my ($option, $value)= each( %old_env )) {
if (defined $value){ if (defined $value){
...@@ -2690,15 +2698,12 @@ sub run_testcase ($) { ...@@ -2690,15 +2698,12 @@ sub run_testcase ($) {
mtr_report_test_passed($tinfo, $opt_timer); mtr_report_test_passed($tinfo, $opt_timer);
} }
if ( $opt_check_testcases ) if ( $opt_check_testcases and check_testcase($tinfo, "after"))
{ {
if (check_testcase($tinfo, "after")) # Stop all servers that are known to be running
{ stop_all_servers();
# Stop all servers that are known to be running clean_datadir();
stop_all_servers(); mtr_report("Resuming tests...\n");
after_test_failure($tinfo->{'name'});
mtr_report("Resuming tests...\n");
}
} }
} }
elsif ( $res == 62 ) elsif ( $res == 62 )
...@@ -2765,7 +2770,7 @@ sub run_testcase ($) { ...@@ -2765,7 +2770,7 @@ sub run_testcase ($) {
{ {
# Server failed, probably crashed # Server failed, probably crashed
$tinfo->{comment}= $tinfo->{comment}=
"Server failed during test run"; "Server $proc failed during test run";
report_failure_and_restart($tinfo); report_failure_and_restart($tinfo);
return 1; return 1;
...@@ -2910,67 +2915,119 @@ sub check_expected_crash_and_restart { ...@@ -2910,67 +2915,119 @@ sub check_expected_crash_and_restart {
} }
sub clean_datadir {
mtr_verbose("Cleaning datadirs...");
foreach my $cluster ( clusters() )
{
my $cluster_dir= "$opt_vardir/".$cluster->{name};
mtr_verbose(" - removing '$cluster_dir'");
rmtree($cluster_dir);
}
foreach my $mysqld ( mysqlds() )
{
my $mysqld_dir= dirname($mysqld->value('datadir'));
if (-d $mysqld_dir ) {
mtr_verbose(" - removing '$mysqld_dir'");
rmtree($mysqld_dir);
}
}
# Remove all files in tmp and var/tmp
rmtree("$opt_vardir/tmp");
mkpath("$opt_vardir/tmp");
if ($opt_tmpdir ne "$opt_vardir/tmp"){
rmtree($opt_tmpdir);
mkpath($opt_tmpdir);
}
}
# #
# Save any interesting files in the data_dir # Limit number of core files saved
# before the data dir is removed.
# #
sub save_files_after_test_failure($$) { sub limit_cores_after_failure ($) {
my $test_name= shift; my ($datadir)= @_;
my $data_dir= shift;
my $save_name= "$opt_vardir/log/$test_name";
# Look for core files # Look for core files
foreach my $core_file ( glob("$data_dir/core*") ) foreach my $core_file ( glob("$datadir/core*") )
{ {
last if $opt_max_save_core > 0 && $num_saved_cores >= $opt_max_save_core;
my $core_name= basename($core_file); my $core_name= basename($core_file);
mtr_report(" - saving '$core_name'"); if ($opt_max_save_core > 0 && $num_saved_cores >= $opt_max_save_core) {
mkpath($save_name) if ! -d $save_name; # Delete file to avoid saving it when the datadir is later saved
rename("$core_file", "$save_name/$core_name"); mtr_report(" - deleting '$core_name'",
"($num_saved_cores/$opt_max_save_core)");
unlink("$core_file");
}
else {
mtr_report(" - found '$core_name'",
"($num_saved_cores/$opt_max_save_core)");
}
++$num_saved_cores; ++$num_saved_cores;
} }
} }
#
# Save datadir before it's removed
#
sub save_datadir_after_failure($$) {
my ($dir, $savedir)= @_;
sub after_test_failure ($) { if ($opt_max_save_datadir > 0 &&
my $test_name= shift; $num_saved_datadir >= $opt_max_save_datadir)
mtr_report("Cleaning datadirs...");
foreach my $mysqld ( mysqlds() )
{ {
my $data_dir= $mysqld->value('datadir'); mtr_report(" - skipping '$dir'");
my $name= basename($data_dir); }
save_files_after_test_failure($test_name, $data_dir); else {
mtr_debug("Removing '$data_dir'"); mtr_report(" - saving '$dir'");
rmtree($data_dir); my $dir_name= basename($dir);
rename("$dir", "$savedir/$dir_name");
} }
}
# Remove the ndb_*_fs dirs for all ndbd nodes
# forcing a clean start of ndb next time sub after_failure ($) {
foreach my $cluster ( clusters() ) my ($tinfo)= @_;
{
foreach my $ndbd ( ndbds($cluster) ) mtr_report("Saving datadirs...");
{
my $data_dir= $ndbd->value('DataDir'); my $save_dir= "$opt_vardir/log/";
foreach my $fs_dir ( glob("$data_dir/ndb_*_fs") ) { $save_dir.= $tinfo->{name};
rmtree($fs_dir); # Add combination name if any
mtr_debug("Removing '$fs_dir'"); $save_dir.= "_$tinfo->{combination}"
if defined $tinfo->{combination};
mkpath($save_dir) if ! -d $save_dir;
# Save the used my.cnf file
copy($path_config_file, $save_dir);
if ( clusters() ) {
foreach my $cluster ( clusters() ) {
foreach my $server ( ndbds($cluster), ndb_mgmds($cluster) ) {
my $data_dir= $server->value('DataDir');
limit_cores_after_failure($data_dir);
} }
my $backup_dir= $ndbd->value('BackupDataDir'); my $cluster_dir= "$opt_vardir/".$cluster->{name};
rmtree("$backup_dir/BACKUP"); save_datadir_after_failure($cluster_dir, $save_dir);
mtr_debug("Removing '$backup_dir'");
} }
} }
else {
# Remove all files in tmp and var/tmp foreach my $mysqld ( mysqlds() ) {
rmtree("$opt_vardir/tmp"); my $data_dir= $mysqld->value('datadir');
mkpath("$opt_vardir/tmp"); limit_cores_after_failure($data_dir);
if ($opt_tmpdir ne "$opt_vardir/tmp"){ save_datadir_after_failure(dirname($data_dir), $save_dir);
rmtree($opt_tmpdir); }
mkpath($opt_tmpdir);
} }
$num_saved_datadir++;
clean_datadir();
} }
...@@ -2983,7 +3040,7 @@ sub report_failure_and_restart ($) { ...@@ -2983,7 +3040,7 @@ sub report_failure_and_restart ($) {
stop_all_servers(); stop_all_servers();
# Collect and clean files # Collect and clean files
after_test_failure($tinfo->{'name'}); after_failure($tinfo);
mtr_report("Resuming tests...\n"); mtr_report("Resuming tests...\n");
} }
...@@ -4117,7 +4174,12 @@ Options for debugging the product ...@@ -4117,7 +4174,12 @@ Options for debugging the product
Example: $0 --strace-client=ktrace Example: $0 --strace-client=ktrace
max-save-core Limit the number of core files saved (to avoid filling max-save-core Limit the number of core files saved (to avoid filling
up disks for heavily crashing server). Defaults to up disks for heavily crashing server). Defaults to
$opt_max_save_core, set to 0 for no limit. $opt_max_save_core, set to 0 for no limit. Set
it's default with MTR_MAX_SAVE_CORE
max-save-datadir Limit the number of datadir saved (to avoid filling
up disks for heavily crashing server). Defaults to
$opt_max_save_datadir, set to 0 for no limit. Set
it's default with MTR_MAX_SAVE_DATDIR
Options for valgrind Options for valgrind
......
*** Set up circular ring by schema A->B->C-D->A *** *** Set up circular ring by schema A->B->C->D->A ***
stop slave; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
......
...@@ -15,5 +15,4 @@ rpl_innodb_bug28430 : Bug #32247 2007-11-27 mats Test reports wrong value o ...@@ -15,5 +15,4 @@ rpl_innodb_bug28430 : Bug #32247 2007-11-27 mats Test reports wrong value o
rpl_view : Bug#32654: rpl_view.test fails randomly rpl_view : Bug#32654: rpl_view.test fails randomly
rpl_ndb_multi : Bug#30751: rpl_ndb_multi missing row in output rpl_ndb_multi : Bug#30751: rpl_ndb_multi missing row in output
rpl_log_pos : Bug#8693 Test 'rpl_log_pos' fails sometimes rpl_log_pos : Bug#8693 Test 'rpl_log_pos' fails sometimes
rpl_circular_for_4_hosts : Needs updated config
!include ../my.cnf
[mysqld.1]
log-slave-updates
innodb
[mysqld.2]
log-slave-updates
innodb
[mysqld.3]
log-slave-updates
innodb
[mysqld.4]
log-slave-updates
innodb
[ENV]
SLAVE_MYPORT1= @mysqld.3.port
SLAVE_MYSOCK1= @mysqld.3.socket
SLAVE_MYPORT2= @mysqld.4.port
SLAVE_MYSOCK2= @mysqld.4.socket
...@@ -97,5 +97,6 @@ COUNT(*) SUM(a) b ...@@ -97,5 +97,6 @@ COUNT(*) SUM(a) b
100 64100 master1 100 64100 master1
100 64000 slave 100 64000 slave
DELETE FROM t1; DROP TABLE t1;
DROP TABLE IF EXISTS t1;
...@@ -12,6 +12,5 @@ ...@@ -12,6 +12,5 @@
rpl_ndb_circular : Bug#33849 COMMIT event missing in cluster circular replication. rpl_ndb_circular : Bug#33849 COMMIT event missing in cluster circular replication.
rpl_ndb_circular_simplex : Bug#33849 COMMIT event missing in cluster circular replication. rpl_ndb_circular_simplex : Bug#33849 COMMIT event missing in cluster circular replication.
rpl_ndb_circular_2ch : Bug#33849 COMMIT event missing in cluster circular replication.
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
rpl_ndb_circular_2ch : Needs updated config
--slave-num=2 --server-id=1 --log-bin -log-slave-updates
--server-id=2 --log-bin --log-slave-updates --skip-slave-start
!include ../my.cnf
[mysqld.1.1]
server-id= 1
log-bin
log-slave-updates
[mysqld.2.1]
server-id= 1
log-bin
log-slave-updates
[mysqld.1.slave]
server-id= 2
log-bin
log-slave-updates
skip-slave-start
[mysqld.2.slave]
server-id= 2
master-host= 127.0.0.1
master-port= @mysqld.2.1.port
master-password= @mysqld.2.1.#password
master-user= @mysqld.2.1.#user
master-connect-retry= 1
init-rpl-role= slave
log-bin
log-slave-updates
skip-slave-start
ndb_connectstring= @mysql_cluster.slave.ndb_connectstring
[ENV]
SLAVE_MYPORT1= @mysqld.2.slave.port
SLAVE_MYSOCK1= @mysqld.2.slave.socket
...@@ -170,10 +170,11 @@ SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b; ...@@ -170,10 +170,11 @@ SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b;
# Clean up # Clean up
--connection master --connection master
DELETE FROM t1; DROP TABLE t1;
--connection slave --connection slave
let $wait_condition= SELECT COUNT(*)=0 FROM t1; --disable_warings
--source include/wait_condition.inc DROP TABLE IF EXISTS t1;
--enable_warnings
--echo --echo
# End of test 5.1 # End of test 5.1
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