mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Merge mysql.com:/home/jimw/my/mysql-5.0-clean
into mysql.com:/home/jimw/my/mysql-5.1-clean
This commit is contained in:
@@ -12,6 +12,7 @@ sub mtr_init_args ($);
|
||||
sub mtr_add_arg ($$@);
|
||||
sub mtr_path_exists(@);
|
||||
sub mtr_script_exists(@);
|
||||
sub mtr_file_exists(@);
|
||||
sub mtr_exe_exists(@);
|
||||
sub mtr_copy_dir($$);
|
||||
sub mtr_same_opts($$);
|
||||
@@ -94,6 +95,14 @@ sub mtr_script_exists (@) {
|
||||
}
|
||||
}
|
||||
|
||||
sub mtr_file_exists (@) {
|
||||
foreach my $path ( @_ )
|
||||
{
|
||||
return $path if -e $path;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
sub mtr_exe_exists (@) {
|
||||
my @path= @_;
|
||||
map {$_.= ".exe"} @path if $::glob_win32;
|
||||
@@ -111,18 +120,27 @@ sub mtr_exe_exists (@) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub mtr_copy_dir($$) {
|
||||
my $srcdir= shift;
|
||||
my $dstdir= shift;
|
||||
my $from_dir= shift;
|
||||
my $to_dir= shift;
|
||||
|
||||
mkpath("$to_dir");
|
||||
opendir(DIR, "$from_dir")
|
||||
or mtr_error("Can't find $from_dir$!");
|
||||
for(readdir(DIR)) {
|
||||
next if "$_" eq "." or "$_" eq "..";
|
||||
if ( -d "$from_dir/$_" )
|
||||
{
|
||||
mtr_copy_dir("$from_dir/$_", "$to_dir/$_");
|
||||
next;
|
||||
}
|
||||
copy("$from_dir/$_", "$to_dir/$_");
|
||||
}
|
||||
closedir(DIR);
|
||||
|
||||
# Create destination directory
|
||||
mkpath($dstdir);
|
||||
find(\&mtr_copy_one_file, $dstdir);
|
||||
}
|
||||
|
||||
sub mtr_copy_one_file {
|
||||
print $File::Find::name, "\n";
|
||||
}
|
||||
|
||||
sub mtr_same_opts ($$) {
|
||||
my $l1= shift;
|
||||
|
@@ -674,10 +674,12 @@ sub mtr_mysqladmin_shutdown {
|
||||
mtr_add_arg($args, "shutdown");
|
||||
# Start mysqladmin in paralell and wait for termination later
|
||||
my $pid= mtr_spawn($::exe_mysqladmin, $args,
|
||||
"", $::path_manager_log, $::path_manager_log, "",
|
||||
"", $path_mysqladmin_log, $path_mysqladmin_log, "",
|
||||
{ append_log_file => 1 });
|
||||
# Save the pid of the mysqladmin process
|
||||
$mysql_admin_pids{$pid}= 1;
|
||||
|
||||
# We don't wait for termination of mysqladmin
|
||||
}
|
||||
|
||||
# Wait for all the started mysqladmin to exit
|
||||
@@ -720,8 +722,6 @@ sub mtr_mysqladmin_shutdown {
|
||||
|
||||
$timeout or mtr_debug("At least one server is still listening to its port");
|
||||
|
||||
sleep(5) if $::glob_win32; # FIXME next startup fails if no sleep
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -821,8 +821,10 @@ sub sleep_until_file_created ($$$) {
|
||||
my $pidfile= shift;
|
||||
my $timeout= shift;
|
||||
my $pid= shift;
|
||||
my $sleeptime= 100; # Milliseconds
|
||||
my $loops= ($timeout * 1000) / $sleeptime;
|
||||
|
||||
for ( my $loop= 1; $loop <= $timeout; $loop++ )
|
||||
for ( my $loop= 1; $loop <= $loops; $loop++ )
|
||||
{
|
||||
if ( -r $pidfile )
|
||||
{
|
||||
@@ -835,16 +837,20 @@ sub sleep_until_file_created ($$$) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
mtr_debug("Sleep 1 second waiting for creation of $pidfile");
|
||||
mtr_debug("Sleep $sleeptime milliseconds waiting for ".
|
||||
"creation of $pidfile");
|
||||
|
||||
if ( $loop % 60 == 0 )
|
||||
# Print extra message every 60 seconds
|
||||
my $seconds= ($loop * $sleeptime) / 1000;
|
||||
if ( $seconds > 1 and $seconds % 60 == 0 )
|
||||
{
|
||||
my $left= $timeout - $loop;
|
||||
mtr_warning("Waited $loop seconds for $pidfile to be created, " .
|
||||
my $left= $timeout - $seconds;
|
||||
mtr_warning("Waited $seconds seconds for $pidfile to be created, " .
|
||||
"still waiting for $left seconds...");
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
# Millisceond sleep emulated with select
|
||||
select(undef, undef, undef, ($sleeptime/1000));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user