Commit d24868cb authored by unknown's avatar unknown

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb

into mysql.com:/home/jonas/src/mysql-5.0-ndb


ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
  Auto merged
parents 05dd2fc5 a38d1871
...@@ -35,13 +35,72 @@ sub mtr_get_opts_from_file ($) { ...@@ -35,13 +35,72 @@ sub mtr_get_opts_from_file ($) {
while ( <FILE> ) while ( <FILE> )
{ {
chomp; chomp;
s/\$MYSQL_TEST_DIR/$::glob_mysql_test_dir/g;
push(@args, split(' ', $_)); # --set-variable=init_connect=set @a='a\\0c'
s/^\s+//; # Remove leading space
s/\s+$//; # Remove ending space
# This is strange, but we need to fill whitespace inside
# quotes with something, to remove later. We do this to
# be able to split on space. Else, we have trouble with
# options like
#
# --someopt="--insideopt1 --insideopt2"
#
# But still with this, we are not 100% sure it is right,
# we need a shell to do it right.
# print STDERR "\n";
# print STDERR "AAA: $_\n";
s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge;
s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge;
s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge;
s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge;
# print STDERR "BBB: $_\n";
# foreach my $arg (/(--?\w.*?)(?=\s+--?\w|$)/)
# FIXME ENV vars should be expanded!!!!
foreach my $arg (split(/[ \t]+/))
{
$arg =~ tr/\x11\x0a\x0b/ \'\"/; # Put back real chars
# The outermost quotes has to go
$arg =~ s/^([^\'\"]*)\'(.*)\'([^\'\"]*)$/$1$2$3/
or $arg =~ s/^([^\'\"]*)\"(.*)\"([^\'\"]*)$/$1$2$3/;
$arg =~ s/\\\\/\\/g;
$arg =~ s/\$\{(\w+)\}/envsubst($1)/ge;
$arg =~ s/\$(\w+)/envsubst($1)/ge;
# print STDERR "ARG: $arg\n";
push(@args, $arg);
}
} }
close FILE; close FILE;
return \@args; return \@args;
} }
sub envsubst {
my $string= shift;
if ( ! defined $ENV{$string} )
{
mtr_error("opt file referense \$$string that is unknown");
}
return $ENV{$string};
}
sub unspace {
my $string= shift;
my $quote= shift;
$string =~ s/[ \t]/\x11/g;
return "$quote$string$quote";
}
sub mtr_fromfile ($) { sub mtr_fromfile ($) {
my $file= shift; my $file= shift;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# and is part of the translation of the Bourne shell script with the # and is part of the translation of the Bourne shell script with the
# same name. # same name.
use Carp qw(cluck); #use Carp qw(cluck);
use strict; use strict;
use POSIX ":sys_wait_h"; use POSIX ":sys_wait_h";
...@@ -64,18 +64,6 @@ sub spawn_impl ($$$$$$$) { ...@@ -64,18 +64,6 @@ sub spawn_impl ($$$$$$$) {
my $error= shift; my $error= shift;
my $pid_file= shift; # FIXME my $pid_file= shift; # FIXME
# FIXME really needing a PATH???
# $ENV{'PATH'}= "/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$ENV{'PATH'}";
$ENV{'TZ'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work
$ENV{'LC_COLLATE'}= "C";
$ENV{'MYSQL_TEST_DIR'}= $::glob_mysql_test_dir;
$ENV{'MASTER_MYPORT'}= $::opt_master_myport;
$ENV{'SLAVE_MYPORT'}= $::opt_slave_myport;
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
$ENV{'MYSQL_TCP_PORT'}= 3306;
$ENV{'MASTER_MYSOCK'}= $::master->[0]->{'path_mysock'};
if ( $::opt_script_debug ) if ( $::opt_script_debug )
{ {
print STDERR "\n"; print STDERR "\n";
...@@ -85,17 +73,21 @@ sub spawn_impl ($$$$$$$) { ...@@ -85,17 +73,21 @@ sub spawn_impl ($$$$$$$) {
print STDERR "#### ", "STDERR $error\n" if $error; print STDERR "#### ", "STDERR $error\n" if $error;
if ( $join ) if ( $join )
{ {
print STDERR "#### ", "run"; print STDERR "#### ", "RUN ";
} }
else else
{ {
print STDERR "#### ", "spawn"; print STDERR "#### ", "SPAWN ";
} }
print STDERR "$path ", join(" ",@$arg_list_t), "\n"; print STDERR "$path ", join(" ",@$arg_list_t), "\n";
print STDERR "#### ", "-" x 78, "\n"; print STDERR "#### ", "-" x 78, "\n";
} }
my $pid= fork(); my $pid= fork();
if ( ! defined $pid )
{
mtr_error("$path ($pid) can't be forked");
}
if ( $pid ) if ( $pid )
{ {
...@@ -104,17 +96,22 @@ sub spawn_impl ($$$$$$$) { ...@@ -104,17 +96,22 @@ sub spawn_impl ($$$$$$$) {
{ {
# We run a command and wait for the result # We run a command and wait for the result
# FIXME this need to be improved # FIXME this need to be improved
waitpid($pid,0); my $res= waitpid($pid,0);
if ( $res == -1 )
{
mtr_error("$path ($pid) got lost somehow");
}
my $exit_value= $? >> 8; my $exit_value= $? >> 8;
my $signal_num= $? & 127; my $signal_num= $? & 127;
my $dumped_core= $? & 128; my $dumped_core= $? & 128;
if ( $signal_num ) if ( $signal_num )
{ {
mtr_error("spawn got signal $signal_num"); mtr_error("$path ($pid) got signal $signal_num");
} }
if ( $dumped_core ) if ( $dumped_core )
{ {
mtr_error("spawn dumped core"); mtr_error("$path ($pid) dumped core");
} }
return $exit_value; return $exit_value;
} }
...@@ -326,7 +323,8 @@ sub mtr_stop_mysqld_servers ($$) { ...@@ -326,7 +323,8 @@ sub mtr_stop_mysqld_servers ($$) {
mtr_init_args(\$args); mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "-uroot"); mtr_add_arg($args, "--user=%s", $::opt_user);
mtr_add_arg($args, "--password=");
if ( -e $srv->{'sockfile'} ) if ( -e $srv->{'sockfile'} )
{ {
mtr_add_arg($args, "--socket=%s", $srv->{'sockfile'}); mtr_add_arg($args, "--socket=%s", $srv->{'sockfile'});
...@@ -336,7 +334,8 @@ sub mtr_stop_mysqld_servers ($$) { ...@@ -336,7 +334,8 @@ sub mtr_stop_mysqld_servers ($$) {
mtr_add_arg($args, "--port=%s", $srv->{'port'}); mtr_add_arg($args, "--port=%s", $srv->{'port'});
} }
mtr_add_arg($args, "--connect_timeout=5"); mtr_add_arg($args, "--connect_timeout=5");
mtr_add_arg($args, "--shutdown_timeout=70"); mtr_add_arg($args, "--shutdown_timeout=20");
mtr_add_arg($args, "--protocol=tcp"); # FIXME new thing, will it help?!
mtr_add_arg($args, "shutdown"); mtr_add_arg($args, "shutdown");
# We don't wait for termination of mysqladmin # We don't wait for termination of mysqladmin
mtr_spawn($::exe_mysqladmin, $args, mtr_spawn($::exe_mysqladmin, $args,
...@@ -361,6 +360,10 @@ sub mtr_stop_mysqld_servers ($$) { ...@@ -361,6 +360,10 @@ sub mtr_stop_mysqld_servers ($$) {
{ {
last PIDSOCKFILEREMOVED; last PIDSOCKFILEREMOVED;
} }
if ( $loop % 20 == 1 )
{
mtr_warning("Still processes alive after 10 seconds, retrying for $loop seconds...");
}
mtr_debug("Sleep for 1 second waiting for pid and socket file removal"); mtr_debug("Sleep for 1 second waiting for pid and socket file removal");
sleep(1); # One second sleep(1); # One second
} }
...@@ -464,4 +467,40 @@ sub stop_reap_all { ...@@ -464,4 +467,40 @@ sub stop_reap_all {
$SIG{CHLD}= 'DEFAULT'; $SIG{CHLD}= 'DEFAULT';
} }
##############################################################################
#
# Wait for a file to be created
#
##############################################################################
sub sleep_until_file_created ($$) {
my $pidfile= shift;
my $timeout= shift;
my $loop= $timeout;
while ( $loop-- )
{
if ( -r $pidfile )
{
return;
}
mtr_debug("Sleep for 1 second waiting for creation of $pidfile");
if ( $loop % 20 == 1 )
{
mtr_warning("Waiting for $pidfile to be created, still trying for $loop seconds...");
}
sleep(1);
}
if ( ! -r $pidfile )
{
mtr_error("No $pidfile was created");
}
}
1; 1;
This diff is collapsed.
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