mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge shellback.(none):/home/msvensson/mysql/mysql-4.1-maint
into shellback.(none):/home/msvensson/mysql/mysql-5.0-maint client/mysqltest.c: Auto merged mysql-test/lib/mtr_io.pl: Auto merged mysql-test/lib/mtr_process.pl: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/t/rename.test: Manual mereg
This commit is contained in:
25
mysql-test/include/wait_for_query_to_suceed.inc
Normal file
25
mysql-test/include/wait_for_query_to_suceed.inc
Normal file
@ -0,0 +1,25 @@
|
||||
#
|
||||
# Run a query over and over until it suceeds ot timeout occurs
|
||||
#
|
||||
|
||||
|
||||
let $counter= 100;
|
||||
|
||||
disable_abort_on_error;
|
||||
disable_query_log;
|
||||
disable_result_log;
|
||||
eval $query;
|
||||
while ($mysql_errno)
|
||||
{
|
||||
eval $query;
|
||||
sleep 0.1;
|
||||
dec $counter;
|
||||
|
||||
if (!$counter)
|
||||
{
|
||||
die("Waited too long for query to suceed");
|
||||
}
|
||||
}
|
||||
enable_abort_on_error;
|
||||
enable_query_log;
|
||||
enable_result_log;
|
@ -37,18 +37,16 @@ sub mtr_get_pid_from_file ($) {
|
||||
open(FILE, '<', $pid_file_path)
|
||||
or mtr_error("can't open file \"$pid_file_path\": $!");
|
||||
|
||||
# Read pid number from file
|
||||
my $pid= <FILE>;
|
||||
|
||||
chomp($pid) if defined $pid;
|
||||
|
||||
close FILE;
|
||||
|
||||
return $pid if defined $pid && $pid ne '';
|
||||
return $pid if $pid=~ /^(\d+)/;
|
||||
|
||||
mtr_debug("Pid file '$pid_file_path' is empty. " .
|
||||
"Sleeping $timeout second(s)...");
|
||||
mtr_debug("Pid file '$pid_file_path' does not yet contain pid number.\n" .
|
||||
"Sleeping $timeout second(s) more...");
|
||||
|
||||
sleep(1);
|
||||
sleep($timeout);
|
||||
}
|
||||
|
||||
mtr_error("Pid file '$pid_file_path' is corrupted. " .
|
||||
|
@ -438,25 +438,35 @@ sub mtr_kill_leftovers () {
|
||||
|
||||
while ( my $elem= readdir(RUNDIR) )
|
||||
{
|
||||
my $pidfile= "$rundir/$elem";
|
||||
|
||||
if ( -f $pidfile )
|
||||
# Only read pid from files that end with .pid
|
||||
if ( $elem =~ /.*[.]pid$/)
|
||||
{
|
||||
mtr_debug("Processing PID file: '$pidfile'...");
|
||||
|
||||
my $pid= mtr_get_pid_from_file($pidfile);
|
||||
my $pidfile= "$rundir/$elem";
|
||||
|
||||
mtr_debug("Got pid: $pid from file '$pidfile'");
|
||||
if ( -f $pidfile )
|
||||
{
|
||||
mtr_debug("Processing PID file: '$pidfile'...");
|
||||
|
||||
if ( $::glob_cygwin_perl or kill(0, $pid) )
|
||||
{
|
||||
mtr_debug("There is process with pid $pid -- scheduling for kill.");
|
||||
push(@pids, $pid); # We know (cygwin guess) it exists
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("There is no process with pid $pid -- skipping.");
|
||||
}
|
||||
my $pid= mtr_get_pid_from_file($pidfile);
|
||||
|
||||
mtr_debug("Got pid: $pid from file '$pidfile'");
|
||||
|
||||
if ( $::glob_cygwin_perl or kill(0, $pid) )
|
||||
{
|
||||
mtr_debug("There is process with pid $pid -- scheduling for kill.");
|
||||
push(@pids, $pid); # We know (cygwin guess) it exists
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("There is no process with pid $pid -- skipping.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_warning("Found non pid file $elem in $rundir");
|
||||
next;
|
||||
}
|
||||
}
|
||||
closedir(RUNDIR);
|
||||
|
@ -1801,14 +1801,16 @@ sub environment_setup () {
|
||||
# ----------------------------------------------------
|
||||
# Setup env so childs can execute mysql_fix_system_tables
|
||||
# ----------------------------------------------------
|
||||
my $cmdline_mysql_fix_system_tables=
|
||||
"$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
|
||||
"--user=root --password= " .
|
||||
"--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
|
||||
"--port=$master->[0]->{'port'} " .
|
||||
"--socket=$master->[0]->{'path_sock'}";
|
||||
|
||||
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
|
||||
if ( ! $glob_win32 )
|
||||
{
|
||||
my $cmdline_mysql_fix_system_tables=
|
||||
"$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
|
||||
"--user=root --password= " .
|
||||
"--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
|
||||
"--port=$master->[0]->{'port'} " .
|
||||
"--socket=$master->[0]->{'path_sock'}";
|
||||
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
|
||||
}
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Setup env so childs can execute my_print_defaults
|
||||
|
@ -43,8 +43,8 @@ select * from t3;
|
||||
drop table if exists t1,t2,t3,t4;
|
||||
|
||||
#
|
||||
# Test-case for Bug #2397 RENAME TABLES is not blocked by
|
||||
# FLUSH TABLES WITH READ LOCK
|
||||
# Bug #2397 RENAME TABLES is not blocked by
|
||||
# FLUSH TABLES WITH READ LOCK
|
||||
#
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
@ -58,12 +58,17 @@ FLUSH TABLES WITH READ LOCK;
|
||||
connection con1;
|
||||
send RENAME TABLE t1 TO t2, t3 to t4;
|
||||
connection con2;
|
||||
sleep 1;
|
||||
show tables;
|
||||
UNLOCK TABLES;
|
||||
connection con1;
|
||||
reap;
|
||||
connection con2;
|
||||
|
||||
# Wait for the the tables to be renamed
|
||||
# i.e the query below succeds
|
||||
let $query= select * from t2, t4;
|
||||
source include/wait_for_query_to_suceed.inc;
|
||||
|
||||
show tables;
|
||||
|
||||
drop table t2, t4;
|
||||
|
Reference in New Issue
Block a user