mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge MySQL 5.1.46 into MariaDB.
Still two test failures to be solved: main.myisam and main.subselect.
This commit is contained in:
@ -357,11 +357,14 @@ sub post_check_client_group {
|
||||
|
||||
if (IS_WINDOWS)
|
||||
{
|
||||
# Shared memory base may or may not be defined (e.g not defined in embedded)
|
||||
my $shm = $group_to_copy_from->option("shared-memory-base-name");
|
||||
if (defined $shm)
|
||||
if (! $self->{ARGS}->{embedded})
|
||||
{
|
||||
$config->insert($client_group_name,"shared-memory-base-name", $shm->value());
|
||||
# Shared memory base may or may not be defined (e.g not defined in embedded)
|
||||
my $shm = $group_to_copy_from->option("shared-memory-base-name");
|
||||
if (defined $shm)
|
||||
{
|
||||
$config->insert($client_group_name,"shared-memory-base-name", $shm->value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,24 +81,28 @@ sub is_child {
|
||||
}
|
||||
|
||||
|
||||
# Find the safe process binary or script
|
||||
my @safe_process_cmd;
|
||||
my $safe_kill;
|
||||
if (IS_WIN32PERL or IS_CYGWIN){
|
||||
# Use my_safe_process.exe
|
||||
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
|
||||
"my_safe_process");
|
||||
push(@safe_process_cmd, $exe);
|
||||
|
||||
# Use my_safe_kill.exe
|
||||
$safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill");
|
||||
}
|
||||
else
|
||||
{
|
||||
# Use my_safe_process
|
||||
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
|
||||
"my_safe_process");
|
||||
push(@safe_process_cmd, $exe);
|
||||
# Find the safe process binary or script
|
||||
sub find_bin {
|
||||
if (IS_WIN32PERL or IS_CYGWIN)
|
||||
{
|
||||
# Use my_safe_process.exe
|
||||
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
|
||||
"my_safe_process");
|
||||
push(@safe_process_cmd, $exe);
|
||||
|
||||
# Use my_safe_kill.exe
|
||||
$safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill");
|
||||
}
|
||||
else
|
||||
{
|
||||
# Use my_safe_process
|
||||
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
|
||||
"my_safe_process");
|
||||
push(@safe_process_cmd, $exe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -183,63 +187,6 @@ sub run {
|
||||
return $proc->exit_status();
|
||||
}
|
||||
|
||||
#
|
||||
# Start a process that returns after "duration" seconds
|
||||
# or when it's parent process does not exist anymore
|
||||
#
|
||||
sub timer {
|
||||
my $class= shift;
|
||||
my $duration= shift or croak "duration required";
|
||||
my $parent_pid= $$;
|
||||
|
||||
my $pid= My::SafeProcess::Base::_safe_fork();
|
||||
if ($pid){
|
||||
# Parent
|
||||
my $proc= bless
|
||||
({
|
||||
SAFE_PID => $pid,
|
||||
SAFE_NAME => "timer",
|
||||
PARENT => $$,
|
||||
}, $class);
|
||||
|
||||
# Put the new process in list of running
|
||||
$running{$pid}= $proc;
|
||||
return $proc;
|
||||
}
|
||||
|
||||
# Child, install signal handlers and sleep for "duration"
|
||||
$SIG{INT}= 'IGNORE';
|
||||
|
||||
$SIG{TERM}= sub {
|
||||
#print STDERR "timer $$: woken up, exiting!\n";
|
||||
exit(0);
|
||||
};
|
||||
|
||||
$0= "safe_timer($duration)";
|
||||
|
||||
if (IS_WIN32PERL){
|
||||
# Just a thread in same process
|
||||
sleep($duration);
|
||||
print STDERR "timer $$: expired after $duration seconds\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
my $count_down= $duration;
|
||||
while($count_down--){
|
||||
|
||||
# Check that parent is still alive
|
||||
if (kill(0, $parent_pid) == 0){
|
||||
#print STDERR "timer $$: parent gone, exiting!\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
print STDERR "timer $$: expired after $duration seconds\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Shutdown process nicely, and wait for shutdown_timeout seconds
|
||||
# If processes hasn't shutdown, kill them hard and wait for return
|
||||
@ -338,12 +285,12 @@ sub start_kill {
|
||||
$ret= system($safe_kill, $winpid) >> 8;
|
||||
|
||||
if ($ret == 3){
|
||||
print "Couldn't open the winpid: $winpid ",
|
||||
print "Couldn't open the winpid: $winpid ".
|
||||
"for pid: $pid, try one more time\n";
|
||||
sleep(1);
|
||||
$winpid= _winpid($pid);
|
||||
$ret= system($safe_kill, $winpid) >> 8;
|
||||
print "Couldn't open the winpid: $winpid ",
|
||||
print "Couldn't open the winpid: $winpid ".
|
||||
"for pid: $pid, continue and see what happens...\n";
|
||||
}
|
||||
}
|
||||
@ -543,6 +490,40 @@ sub wait_any {
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Wait for any process to exit, or a timeout
|
||||
#
|
||||
# Returns a reference to the SafeProcess that
|
||||
# exited or a pseudo-process with $proc->{timeout} == 1
|
||||
#
|
||||
|
||||
sub wait_any_timeout {
|
||||
my $class= shift;
|
||||
my $timeout= shift;
|
||||
my $proc;
|
||||
my $millis=10;
|
||||
|
||||
do {
|
||||
::mtr_milli_sleep($millis);
|
||||
# Slowly increse interval up to max. 1 second
|
||||
$millis++ if $millis < 1000;
|
||||
# Return a "fake" process for timeout
|
||||
if (::has_expired($timeout)) {
|
||||
$proc= bless
|
||||
({
|
||||
SAFE_PID => 0,
|
||||
SAFE_NAME => "timer",
|
||||
timeout => 1,
|
||||
}, $class);
|
||||
} else {
|
||||
$proc= check_any();
|
||||
}
|
||||
} while (! $proc);
|
||||
|
||||
return $proc;
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Wait for all processes to exit
|
||||
#
|
||||
@ -600,7 +581,7 @@ sub self2str {
|
||||
|
||||
sub _verbose {
|
||||
return unless $_verbose;
|
||||
print STDERR " ## ", @_, "\n";
|
||||
print STDERR " ## ". @_. "\n";
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,14 +186,20 @@ int main(int argc, const char** argv )
|
||||
die("No real args -> nothing to do");
|
||||
/* Copy the remaining args to child_arg */
|
||||
for (int j= i+1; j < argc; j++) {
|
||||
if (strchr (argv[j], ' ')) {
|
||||
/* Protect with "" if this arg contains a space */
|
||||
to+= _snprintf(to, child_args + sizeof(child_args) - to,
|
||||
"\"%s\" ", argv[j]);
|
||||
} else {
|
||||
to+= _snprintf(to, child_args + sizeof(child_args) - to,
|
||||
"%s ", argv[j]);
|
||||
}
|
||||
arg= argv[j];
|
||||
if (strchr (arg, ' ') &&
|
||||
arg[0] != '\"' &&
|
||||
arg[strlen(arg)] != '\"')
|
||||
{
|
||||
/* Quote arg that contains spaces and are not quoted already */
|
||||
to+= _snprintf(to, child_args + sizeof(child_args) - to,
|
||||
"\"%s\" ", arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
to+= _snprintf(to, child_args + sizeof(child_args) - to,
|
||||
"%s ", arg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user