Commit ce1ca195 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 764e9a51 99ee0572
......@@ -18,7 +18,7 @@
--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
......
......@@ -416,7 +416,7 @@ sub post_fix_mysql_cluster_section {
# Add a [mysl_cluster.<suffix>] section for each
# defined [cluster_config.<suffix>] section
foreach my $group ( $config->like('cluster_config\.\w*') )
foreach my $group ( $config->like('cluster_config\.\w*$') )
{
my @urls;
# Generate ndb_connectstring for this cluster
......@@ -497,7 +497,7 @@ sub run_generate_sections_from_cluster_config {
my @options= ('ndb_mgmd', 'ndbd',
'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
my %idxes;
......@@ -580,7 +580,7 @@ sub new_config {
$self->run_section_rules($config,
'cluster_config\.\w*',
'cluster_config\.\w*$',
@cluster_config_rules);
$self->run_generate_sections_from_cluster_config($config);
......
......@@ -722,6 +722,16 @@ sub collect_one_test_case {
# ----------------------------------------------------------------------
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
# ----------------------------------------------------------------------
......
......@@ -196,9 +196,12 @@ our %mysqld_variables;
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 $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);
$| = 1; # Automatically flush STDOUT
......@@ -641,6 +644,7 @@ sub command_line_setup {
'client-debugger=s' => \$opt_client_debugger,
'strace-client:s' => \$opt_strace_client,
'max-save-core=i' => \$opt_max_save_core,
'max-save-datadir=i' => \$opt_max_save_datadir,
# Coverage, profiling etc
'gcov' => \$opt_gcov,
......@@ -2567,6 +2571,10 @@ sub run_testcase ($) {
if ( started(all_servers()) == 0 )
{
# Remove old datadirs
clean_datadir();
# Restore old ENV
while (my ($option, $value)= each( %old_env )) {
if (defined $value){
......@@ -2690,17 +2698,14 @@ sub run_testcase ($) {
mtr_report_test_passed($tinfo, $opt_timer);
}
if ( $opt_check_testcases )
{
if (check_testcase($tinfo, "after"))
if ( $opt_check_testcases and check_testcase($tinfo, "after"))
{
# Stop all servers that are known to be running
stop_all_servers();
after_test_failure($tinfo->{'name'});
clean_datadir();
mtr_report("Resuming tests...\n");
}
}
}
elsif ( $res == 62 )
{
# Testcase itself tell us to skip this one
......@@ -2765,7 +2770,7 @@ sub run_testcase ($) {
{
# Server failed, probably crashed
$tinfo->{comment}=
"Server failed during test run";
"Server $proc failed during test run";
report_failure_and_restart($tinfo);
return 1;
......@@ -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
# before the data dir is removed.
# Limit number of core files saved
#
sub save_files_after_test_failure($$) {
my $test_name= shift;
my $data_dir= shift;
my $save_name= "$opt_vardir/log/$test_name";
sub limit_cores_after_failure ($) {
my ($datadir)= @_;
# 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);
mtr_report(" - saving '$core_name'");
mkpath($save_name) if ! -d $save_name;
rename("$core_file", "$save_name/$core_name");
if ($opt_max_save_core > 0 && $num_saved_cores >= $opt_max_save_core) {
# Delete file to avoid saving it when the datadir is later saved
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;
}
}
#
# Save datadir before it's removed
#
sub save_datadir_after_failure($$) {
my ($dir, $savedir)= @_;
sub after_test_failure ($) {
my $test_name= shift;
mtr_report("Cleaning datadirs...");
foreach my $mysqld ( mysqlds() )
if ($opt_max_save_datadir > 0 &&
$num_saved_datadir >= $opt_max_save_datadir)
{
my $data_dir= $mysqld->value('datadir');
my $name= basename($data_dir);
save_files_after_test_failure($test_name, $data_dir);
mtr_debug("Removing '$data_dir'");
rmtree($data_dir);
mtr_report(" - skipping '$dir'");
}
else {
mtr_report(" - saving '$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
foreach my $cluster ( clusters() )
{
foreach my $ndbd ( ndbds($cluster) )
{
my $data_dir= $ndbd->value('DataDir');
foreach my $fs_dir ( glob("$data_dir/ndb_*_fs") ) {
rmtree($fs_dir);
mtr_debug("Removing '$fs_dir'");
sub after_failure ($) {
my ($tinfo)= @_;
mtr_report("Saving datadirs...");
my $save_dir= "$opt_vardir/log/";
$save_dir.= $tinfo->{name};
# Add combination name if any
$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');
rmtree("$backup_dir/BACKUP");
mtr_debug("Removing '$backup_dir'");
my $cluster_dir= "$opt_vardir/".$cluster->{name};
save_datadir_after_failure($cluster_dir, $save_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);
else {
foreach my $mysqld ( mysqlds() ) {
my $data_dir= $mysqld->value('datadir');
limit_cores_after_failure($data_dir);
save_datadir_after_failure(dirname($data_dir), $save_dir);
}
}
$num_saved_datadir++;
clean_datadir();
}
......@@ -2983,7 +3040,7 @@ sub report_failure_and_restart ($) {
stop_all_servers();
# Collect and clean files
after_test_failure($tinfo->{'name'});
after_failure($tinfo);
mtr_report("Resuming tests...\n");
}
......@@ -4117,7 +4174,12 @@ Options for debugging the product
Example: $0 --strace-client=ktrace
max-save-core Limit the number of core files saved (to avoid filling
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
......
*** Set up circular ring by schema A->B->C-D->A ***
*** Set up circular ring by schema A->B->C->D->A ***
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
......
......@@ -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_ndb_multi : Bug#30751: rpl_ndb_multi missing row in output
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
100 64100 master1
100 64000 slave
DELETE FROM t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
......@@ -12,6 +12,5 @@
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_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
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;
# Clean up
--connection master
DELETE FROM t1;
DROP TABLE t1;
--connection slave
let $wait_condition= SELECT COUNT(*)=0 FROM t1;
--source include/wait_condition.inc
--disable_warings
DROP TABLE IF EXISTS t1;
--enable_warnings
--echo
# 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