mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Merge neptunus.(none):/home/msvensson/mysql/same_tools/my50-same_tools
into neptunus.(none):/home/msvensson/mysql/same_tools/my51-same_tools BitKeeper/deleted/.del-mtr_stress.pl: Auto merged BitKeeper/deleted/.del-ps_6bdb.result: Auto merged BitKeeper/deleted/.del-rpl000018.result: Auto merged BitKeeper/deleted/.del-rpl000018.test: Auto merged BitKeeper/deleted/.del-rpl_chain_temp_table.result: Auto merged BitKeeper/deleted/.del-rpl_chain_temp_table.test: Auto merged BitKeeper/deleted/.del-rpl_failsafe.result: Auto merged BitKeeper/deleted/.del-rpl_failsafe.test: Auto merged BitKeeper/deleted/.del-rpl_heap.result: Auto merged BitKeeper/deleted/.del-rpl_heap.test: Auto merged mysql-test/include/have_ndb.inc: Auto merged mysql-test/include/master-slave.inc: Auto merged mysql-test/lib/mtr_misc.pl: Auto merged mysql-test/lib/mtr_report.pl: Auto merged mysql-test/r/binlog_stm_mix_innodb_myisam.result: Auto merged mysql-test/r/connect.result: Auto merged mysql-test/r/csv.result: Auto merged mysql-test/r/drop.result: Auto merged mysql-test/r/flush_block_commit.result: Auto merged mysql-test/r/func_misc.result: Auto merged mysql-test/r/grant2.result: Auto merged mysql-test/r/handler_myisam.result: Auto merged mysql-test/r/multi_update.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/ps_7ndb.result: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/query_cache_notembedded.result: Auto merged mysql-test/r/rpl_err_ignoredtable.result: Auto merged mysql-test/r/rpl_master_pos_wait.result: Auto merged mysql-test/r/rpl_stm_000001.result: Auto merged mysql-test/r/sp-threads.result: Auto merged mysql-test/r/sp_notembedded.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/synchronization.result: Auto merged mysql-test/r/type_blob.result: Auto merged mysql-test/t/connect.test: Auto merged mysql-test/t/csv.test: Auto merged mysql-test/t/mysql_client_test.test: Auto merged mysql-test/t/ps.test: Auto merged mysql-test/t/ps_1general.test: Auto merged mysql-test/t/ps_grant.test: Auto merged mysql-test/t/query_cache.test: Auto merged mysql-test/t/rpl_trunc_temp.test: Auto merged mysql-test/t/sp-error.test: Auto merged mysql-test/t/sp_notembedded.test: Auto merged mysql-test/t/subselect.test: Auto merged mysql-test/t/view_grant.test: Auto merged mysql-test/extra/rpl_tests/rpl_flsh_tbls.test: SCCS merged
This commit is contained in:
commit
e8fae25e6b
37 changed files with 4279 additions and 3773 deletions
5283
client/mysqltest.c
5283
client/mysqltest.c
File diff suppressed because it is too large
Load diff
|
@ -7,6 +7,8 @@
|
|||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
let $SERVER_VERSION=`select version()`;
|
||||
|
||||
create table t1 (a int);
|
||||
insert into t1 values (10);
|
||||
create table t2 (a int);
|
||||
|
|
|
@ -1,137 +0,0 @@
|
|||
let $1 = 10;
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
echo $1;
|
||||
dec $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
echo here is the sourced script;
|
|
@ -1 +0,0 @@
|
|||
--source include/sourced.inc
|
|
@ -514,13 +514,6 @@ sub collect_one_test_case($$$$$$$) {
|
|||
$tinfo->{'comment'}= "Test need debug binaries";
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $tinfo->{'innodb_test'} && ! $::glob_innodb_supported )
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
$tinfo->{'comment'}= "Test need innodb";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# We can't restart a running server that may be in use
|
||||
|
|
761
mysql-test/lib/mtr_im.pl
Normal file
761
mysql-test/lib/mtr_im.pl
Normal file
|
@ -0,0 +1,761 @@
|
|||
# -*- cperl -*-
|
||||
|
||||
# This is a library file used by the Perl version of mysql-test-run,
|
||||
# and is part of the translation of the Bourne shell script with the
|
||||
# same name.
|
||||
|
||||
use strict;
|
||||
|
||||
# Private IM-related operations.
|
||||
|
||||
sub mtr_im_kill_process ($$$$);
|
||||
sub mtr_im_load_pids ($);
|
||||
sub mtr_im_terminate ($);
|
||||
sub mtr_im_check_alive ($);
|
||||
sub mtr_im_check_main_alive ($);
|
||||
sub mtr_im_check_angel_alive ($);
|
||||
sub mtr_im_check_mysqlds_alive ($);
|
||||
sub mtr_im_check_mysqld_alive ($);
|
||||
sub mtr_im_cleanup ($);
|
||||
sub mtr_im_rm_file ($);
|
||||
sub mtr_im_errlog ($);
|
||||
sub mtr_im_kill ($);
|
||||
sub mtr_im_wait_for_connection ($$$);
|
||||
sub mtr_im_wait_for_mysqld($$$);
|
||||
|
||||
# Public IM-related operations.
|
||||
|
||||
sub mtr_im_start ($$);
|
||||
sub mtr_im_stop ($);
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Private operations.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub mtr_im_kill_process ($$$$) {
|
||||
my $pid_lst= shift;
|
||||
my $signal= shift;
|
||||
my $total_retries= shift;
|
||||
my $timeout= shift;
|
||||
|
||||
my %pids;
|
||||
|
||||
foreach my $pid ( @{$pid_lst} )
|
||||
{
|
||||
$pids{$pid}= 1;
|
||||
}
|
||||
|
||||
for ( my $cur_attempt= 1; $cur_attempt <= $total_retries; ++$cur_attempt )
|
||||
{
|
||||
foreach my $pid ( keys %pids )
|
||||
{
|
||||
mtr_debug("Sending $signal to $pid...");
|
||||
|
||||
kill($signal, $pid);
|
||||
|
||||
unless ( kill (0, $pid) )
|
||||
{
|
||||
mtr_debug("Process $pid died.");
|
||||
delete $pids{$pid};
|
||||
}
|
||||
}
|
||||
|
||||
return if scalar keys %pids == 0;
|
||||
|
||||
mtr_debug("Sleeping $timeout second(s) waiting for processes to die...");
|
||||
|
||||
sleep($timeout);
|
||||
}
|
||||
|
||||
mtr_debug("Process(es) " .
|
||||
join(' ', keys %pids) .
|
||||
" is still alive after $total_retries " .
|
||||
"of sending signal $signal.");
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_load_pids($) {
|
||||
my $im= shift;
|
||||
|
||||
mtr_debug("Loading PID files...");
|
||||
|
||||
# Obtain mysqld-process pids.
|
||||
|
||||
my $instances = $im->{'instances'};
|
||||
|
||||
for ( my $idx= 0; $idx < 2; ++$idx )
|
||||
{
|
||||
mtr_debug("IM-guarded mysqld[$idx] PID file: '" .
|
||||
$instances->[$idx]->{'path_pid'} . "'.");
|
||||
|
||||
my $mysqld_pid;
|
||||
|
||||
if ( -r $instances->[$idx]->{'path_pid'} )
|
||||
{
|
||||
$mysqld_pid= mtr_get_pid_from_file($instances->[$idx]->{'path_pid'});
|
||||
mtr_debug("IM-guarded mysqld[$idx] PID: $mysqld_pid.");
|
||||
}
|
||||
else
|
||||
{
|
||||
$mysqld_pid= undef;
|
||||
mtr_debug("IM-guarded mysqld[$idx]: no PID file.");
|
||||
}
|
||||
|
||||
$instances->[$idx]->{'pid'}= $mysqld_pid;
|
||||
}
|
||||
|
||||
# Re-read Instance Manager PIDs from the file, since during tests Instance
|
||||
# Manager could have been restarted, so its PIDs could have been changed.
|
||||
|
||||
# - IM-main
|
||||
|
||||
mtr_debug("IM-main PID file: '$im->{path_pid}'.");
|
||||
|
||||
if ( -f $im->{'path_pid'} )
|
||||
{
|
||||
$im->{'pid'} =
|
||||
mtr_get_pid_from_file($im->{'path_pid'});
|
||||
|
||||
mtr_debug("IM-main PID: $im->{pid}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-main: no PID file.");
|
||||
$im->{'pid'}= undef;
|
||||
}
|
||||
|
||||
# - IM-angel
|
||||
|
||||
mtr_debug("IM-angel PID file: '$im->{path_angel_pid}'.");
|
||||
|
||||
if ( -f $im->{'path_angel_pid'} )
|
||||
{
|
||||
$im->{'angel_pid'} =
|
||||
mtr_get_pid_from_file($im->{'path_angel_pid'});
|
||||
|
||||
mtr_debug("IM-angel PID: $im->{'angel_pid'}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-angel: no PID file.");
|
||||
$im->{'angel_pid'} = undef;
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_terminate($) {
|
||||
my $im= shift;
|
||||
|
||||
# Load pids from pid-files. We should do it first of all, because IM deletes
|
||||
# them on shutdown.
|
||||
|
||||
mtr_im_load_pids($im);
|
||||
|
||||
mtr_debug("Shutting Instance Manager down...");
|
||||
|
||||
# Ignoring SIGCHLD so that all children could rest in peace.
|
||||
|
||||
start_reap_all();
|
||||
|
||||
# Send SIGTERM to IM-main.
|
||||
|
||||
if ( defined $im->{'pid'} )
|
||||
{
|
||||
mtr_debug("IM-main pid: $im->{pid}.");
|
||||
mtr_debug("Stopping IM-main...");
|
||||
|
||||
mtr_im_kill_process([ $im->{'pid'} ], 'TERM', 10, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-main pid: n/a.");
|
||||
}
|
||||
|
||||
# If IM-angel was alive, wait for it to die.
|
||||
|
||||
if ( defined $im->{'angel_pid'} )
|
||||
{
|
||||
mtr_debug("IM-angel pid: $im->{'angel_pid'}.");
|
||||
mtr_debug("Waiting for IM-angel to die...");
|
||||
|
||||
my $total_attempts= 10;
|
||||
|
||||
for ( my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt )
|
||||
{
|
||||
unless ( kill (0, $im->{'angel_pid'}) )
|
||||
{
|
||||
mtr_debug("IM-angel died.");
|
||||
last;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-angel pid: n/a.");
|
||||
}
|
||||
|
||||
stop_reap_all();
|
||||
|
||||
# Re-load PIDs.
|
||||
|
||||
mtr_im_load_pids($im);
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_check_alive($) {
|
||||
my $im= shift;
|
||||
|
||||
mtr_debug("Checking whether IM-components are alive...");
|
||||
|
||||
return 1 if mtr_im_check_main_alive($im);
|
||||
|
||||
return 1 if mtr_im_check_angel_alive($im);
|
||||
|
||||
return 1 if mtr_im_check_mysqlds_alive($im);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_check_main_alive($) {
|
||||
my $im= shift;
|
||||
|
||||
# Check that the process, that we know to be IM's, is dead.
|
||||
|
||||
if ( defined $im->{'pid'} )
|
||||
{
|
||||
if ( kill (0, $im->{'pid'}) )
|
||||
{
|
||||
mtr_debug("IM-main (PID: $im->{pid}) is alive.");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-main (PID: $im->{pid}) is dead.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("No PID file for IM-main.");
|
||||
}
|
||||
|
||||
# Check that IM does not accept client connections.
|
||||
|
||||
if ( mtr_ping_port($im->{'port'}) )
|
||||
{
|
||||
mtr_debug("IM-main (port: $im->{port}) " .
|
||||
"is accepting connections.");
|
||||
|
||||
mtr_im_errlog("IM-main is accepting connections on port " .
|
||||
"$im->{port}, but there is no " .
|
||||
"process information.");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-main (port: $im->{port}) " .
|
||||
"does not accept connections.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_check_angel_alive($) {
|
||||
my $im= shift;
|
||||
|
||||
# Check that the process, that we know to be the Angel, is dead.
|
||||
|
||||
if ( defined $im->{'angel_pid'} )
|
||||
{
|
||||
if ( kill (0, $im->{'angel_pid'}) )
|
||||
{
|
||||
mtr_debug("IM-angel (PID: $im->{angel_pid}) is alive.");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-angel (PID: $im->{angel_pid}) is dead.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("No PID file for IM-angel.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_check_mysqlds_alive($) {
|
||||
my $im= shift;
|
||||
|
||||
mtr_debug("Checking for IM-guarded mysqld instances...");
|
||||
|
||||
my $instances = $im->{'instances'};
|
||||
|
||||
for ( my $idx= 0; $idx < 2; ++$idx )
|
||||
{
|
||||
mtr_debug("Checking mysqld[$idx]...");
|
||||
|
||||
return 1
|
||||
if mtr_im_check_mysqld_alive($instances->[$idx]);
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_check_mysqld_alive($) {
|
||||
my $mysqld_instance= shift;
|
||||
|
||||
# Check that the process is dead.
|
||||
|
||||
if ( defined $mysqld_instance->{'pid'} )
|
||||
{
|
||||
if ( kill (0, $mysqld_instance->{'pid'}) )
|
||||
{
|
||||
mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is alive.");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is dead.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("No PID file for mysqld instance.");
|
||||
}
|
||||
|
||||
# Check that mysqld does not accept client connections.
|
||||
|
||||
if ( mtr_ping_port($mysqld_instance->{'port'}) )
|
||||
{
|
||||
mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
|
||||
"is accepting connections.");
|
||||
|
||||
mtr_im_errlog("Mysqld is accepting connections on port " .
|
||||
"$mysqld_instance->{port}, but there is no " .
|
||||
"process information.");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
|
||||
"does not accept connections.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_cleanup($) {
|
||||
my $im= shift;
|
||||
|
||||
mtr_im_rm_file($im->{'path_pid'});
|
||||
mtr_im_rm_file($im->{'path_sock'});
|
||||
|
||||
mtr_im_rm_file($im->{'path_angel_pid'});
|
||||
|
||||
for ( my $idx= 0; $idx < 2; ++$idx )
|
||||
{
|
||||
mtr_im_rm_file($im->{'instances'}->[$idx]->{'path_pid'});
|
||||
mtr_im_rm_file($im->{'instances'}->[$idx]->{'path_sock'});
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_rm_file($)
|
||||
{
|
||||
my $file_path= shift;
|
||||
|
||||
if ( -f $file_path )
|
||||
{
|
||||
mtr_debug("Removing '$file_path'...");
|
||||
|
||||
unless ( unlink($file_path) )
|
||||
{
|
||||
mtr_warning("Can not remove '$file_path'.")
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("File '$file_path' does not exist already.");
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_errlog($) {
|
||||
my $msg= shift;
|
||||
|
||||
# Complain in error log so that a warning will be shown.
|
||||
#
|
||||
# TODO: unless BUG#20761 is fixed, we will print the warning to stdout, so
|
||||
# that it can be seen on console and does not produce pushbuild error.
|
||||
|
||||
# my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
|
||||
#
|
||||
# open (ERRLOG, ">>$errlog") ||
|
||||
# mtr_error("Can not open error log ($errlog)");
|
||||
#
|
||||
# my $ts= localtime();
|
||||
# print ERRLOG
|
||||
# "Warning: [$ts] $msg\n";
|
||||
#
|
||||
# close ERRLOG;
|
||||
|
||||
my $ts= localtime();
|
||||
print "Warning: [$ts] $msg\n";
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_kill($) {
|
||||
my $im= shift;
|
||||
|
||||
# Re-load PIDs. That can be useful because some processes could have been
|
||||
# restarted.
|
||||
|
||||
mtr_im_load_pids($im);
|
||||
|
||||
# Ignoring SIGCHLD so that all children could rest in peace.
|
||||
|
||||
start_reap_all();
|
||||
|
||||
# Kill IM-angel first of all.
|
||||
|
||||
if ( defined $im->{'angel_pid'} )
|
||||
{
|
||||
mtr_debug("Killing IM-angel (PID: $im->{angel_pid})...");
|
||||
mtr_im_kill_process([ $im->{'angel_pid'} ], 'KILL', 10, 1)
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-angel is dead.");
|
||||
}
|
||||
|
||||
# Re-load PIDs again.
|
||||
|
||||
mtr_im_load_pids($im);
|
||||
|
||||
# Kill IM-main.
|
||||
|
||||
if ( defined $im->{'pid'} )
|
||||
{
|
||||
mtr_debug("Killing IM-main (PID: $im->pid})...");
|
||||
mtr_im_kill_process([ $im->{'pid'} ], 'KILL', 10, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-main is dead.");
|
||||
}
|
||||
|
||||
# Re-load PIDs again.
|
||||
|
||||
mtr_im_load_pids($im);
|
||||
|
||||
# Kill guarded mysqld instances.
|
||||
|
||||
my @mysqld_pids;
|
||||
|
||||
mtr_debug("Collecting PIDs of mysqld instances to kill...");
|
||||
|
||||
for ( my $idx= 0; $idx < 2; ++$idx )
|
||||
{
|
||||
my $pid= $im->{'instances'}->[$idx]->{'pid'};
|
||||
|
||||
unless ( defined $pid )
|
||||
{
|
||||
next;
|
||||
}
|
||||
|
||||
mtr_debug(" - IM-guarded mysqld[$idx] PID: $pid.");
|
||||
|
||||
push (@mysqld_pids, $pid);
|
||||
}
|
||||
|
||||
if ( scalar @mysqld_pids > 0 )
|
||||
{
|
||||
mtr_debug("Killing IM-guarded mysqld instances...");
|
||||
mtr_im_kill_process(\@mysqld_pids, 'KILL', 10, 1);
|
||||
}
|
||||
|
||||
# That's all.
|
||||
|
||||
stop_reap_all();
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
sub mtr_im_wait_for_connection($$$) {
|
||||
my $im= shift;
|
||||
my $total_attempts= shift;
|
||||
my $connect_timeout= shift;
|
||||
|
||||
mtr_debug("Waiting for IM on port $im->{port} " .
|
||||
"to start accepting connections...");
|
||||
|
||||
for ( my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt )
|
||||
{
|
||||
mtr_debug("Trying to connect to IM ($cur_attempt of $total_attempts)...");
|
||||
|
||||
if ( mtr_ping_port($im->{'port'}) )
|
||||
{
|
||||
mtr_debug("IM is accepting connections " .
|
||||
"on port $im->{port}.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
mtr_debug("Sleeping $connect_timeout...");
|
||||
sleep($connect_timeout);
|
||||
}
|
||||
|
||||
mtr_debug("IM does not accept connections " .
|
||||
"on port $im->{port} after " .
|
||||
($total_attempts * $connect_timeout) . " seconds.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
sub mtr_im_wait_for_mysqld($$$) {
|
||||
my $mysqld= shift;
|
||||
my $total_attempts= shift;
|
||||
my $connect_timeout= shift;
|
||||
|
||||
mtr_debug("Waiting for IM-guarded mysqld on port $mysqld->{port} " .
|
||||
"to start accepting connections...");
|
||||
|
||||
for ( my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt )
|
||||
{
|
||||
mtr_debug("Trying to connect to mysqld " .
|
||||
"($cur_attempt of $total_attempts)...");
|
||||
|
||||
if ( mtr_ping_port($mysqld->{'port'}) )
|
||||
{
|
||||
mtr_debug("Mysqld is accepting connections " .
|
||||
"on port $mysqld->{port}.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
mtr_debug("Sleeping $connect_timeout...");
|
||||
sleep($connect_timeout);
|
||||
}
|
||||
|
||||
mtr_debug("Mysqld does not accept connections " .
|
||||
"on port $mysqld->{port} after " .
|
||||
($total_attempts * $connect_timeout) . " seconds.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Public operations.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub mtr_im_start($$) {
|
||||
my $im = shift;
|
||||
my $opts = shift;
|
||||
|
||||
mtr_debug("Starting Instance Manager...");
|
||||
|
||||
my $args;
|
||||
mtr_init_args(\$args);
|
||||
mtr_add_arg($args, "--defaults-file=%s", $im->{'defaults_file'});
|
||||
|
||||
foreach my $opt ( @{$opts} )
|
||||
{
|
||||
mtr_add_arg($args, $opt);
|
||||
}
|
||||
|
||||
$im->{'pid'} =
|
||||
mtr_spawn(
|
||||
$::exe_im, # path to the executable
|
||||
$args, # cmd-line args
|
||||
'', # stdin
|
||||
$im->{'path_log'}, # stdout
|
||||
$im->{'path_err'}, # stderr
|
||||
'', # pid file path (not used)
|
||||
{ append_log_file => 1 } # append log files
|
||||
);
|
||||
|
||||
unless ( $im->{'pid'} )
|
||||
{
|
||||
mtr_error('Could not start Instance Manager.')
|
||||
}
|
||||
|
||||
# Instance Manager can be run in daemon mode. In this case, it creates
|
||||
# several processes and the parent process, created by mtr_spawn(), exits just
|
||||
# after start. So, we have to obtain Instance Manager PID from the PID file.
|
||||
|
||||
mtr_debug("Waiting for IM to create PID file (" .
|
||||
"path: '$im->{path_pid}'; " .
|
||||
"timeout: $im->{start_timeout})...");
|
||||
|
||||
unless ( sleep_until_file_created($im->{'path_pid'},
|
||||
$im->{'start_timeout'},
|
||||
-1) ) # real PID is still unknown
|
||||
{
|
||||
mtr_debug("IM has not created PID file in $im->{start_timeout} secs.");
|
||||
mtr_debug("Aborting test suite...");
|
||||
|
||||
mtr_kill_leftovers();
|
||||
|
||||
mtr_report("IM has not created PID file in $im->{start_timeout} secs.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
$im->{'pid'}= mtr_get_pid_from_file($im->{'path_pid'});
|
||||
|
||||
mtr_debug("Instance Manager started. PID: $im->{pid}.");
|
||||
|
||||
# Wait until we can connect to IM.
|
||||
|
||||
my $IM_CONNECT_TIMEOUT= 30;
|
||||
|
||||
unless ( mtr_im_wait_for_connection($im,
|
||||
$IM_CONNECT_TIMEOUT, 1) )
|
||||
{
|
||||
mtr_debug("Can not connect to Instance Manager " .
|
||||
"in $IM_CONNECT_TIMEOUT seconds after start.");
|
||||
mtr_debug("Aborting test suite...");
|
||||
|
||||
mtr_kill_leftovers();
|
||||
|
||||
mtr_report("Can not connect to Instance Manager " .
|
||||
"in $IM_CONNECT_TIMEOUT seconds after start.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
# Wait for IM to start guarded instances:
|
||||
# - wait for PID files;
|
||||
|
||||
mtr_debug("Waiting for guarded mysqlds instances to create PID files...");
|
||||
|
||||
for ( my $idx= 0; $idx < 2; ++$idx )
|
||||
{
|
||||
my $mysqld= $im->{'instances'}->[$idx];
|
||||
|
||||
if ( exists $mysqld->{'nonguarded'} )
|
||||
{
|
||||
next;
|
||||
}
|
||||
|
||||
mtr_debug("Waiting for mysqld[$idx] to create PID file (" .
|
||||
"path: '$mysqld->{path_pid}'; " .
|
||||
"timeout: $mysqld->{start_timeout})...");
|
||||
|
||||
unless ( sleep_until_file_created($mysqld->{'path_pid'},
|
||||
$mysqld->{'start_timeout'},
|
||||
-1) ) # real PID is still unknown
|
||||
{
|
||||
mtr_debug("mysqld[$idx] has not created PID file in " .
|
||||
"$mysqld->{start_timeout} secs.");
|
||||
mtr_debug("Aborting test suite...");
|
||||
|
||||
mtr_kill_leftovers();
|
||||
|
||||
mtr_report("mysqld[$idx] has not created PID file in " .
|
||||
"$mysqld->{start_timeout} secs.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
mtr_debug("PID file for mysqld[$idx] ($mysqld->{path_pid} created.");
|
||||
}
|
||||
|
||||
# Wait until we can connect to guarded mysqld-instances
|
||||
# (in other words -- wait for IM to start guarded instances).
|
||||
|
||||
mtr_debug("Waiting for guarded mysqlds to start accepting connections...");
|
||||
|
||||
for ( my $idx= 0; $idx < 2; ++$idx )
|
||||
{
|
||||
my $mysqld= $im->{'instances'}->[$idx];
|
||||
|
||||
if ( exists $mysqld->{'nonguarded'} )
|
||||
{
|
||||
next;
|
||||
}
|
||||
|
||||
mtr_debug("Waiting for mysqld[$idx] to accept connection...");
|
||||
|
||||
unless ( mtr_im_wait_for_mysqld($mysqld, 30, 1) )
|
||||
{
|
||||
mtr_debug("Can not connect to mysqld[$idx] " .
|
||||
"in $IM_CONNECT_TIMEOUT seconds after start.");
|
||||
mtr_debug("Aborting test suite...");
|
||||
|
||||
mtr_kill_leftovers();
|
||||
|
||||
mtr_report("Can not connect to mysqld[$idx] " .
|
||||
"in $IM_CONNECT_TIMEOUT seconds after start.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
mtr_debug("mysqld[$idx] started.");
|
||||
}
|
||||
|
||||
mtr_debug("Instance Manager and its components are up and running.");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
sub mtr_im_stop($) {
|
||||
my $im= shift;
|
||||
|
||||
mtr_debug("Stopping Instance Manager...");
|
||||
|
||||
# Try graceful shutdown.
|
||||
|
||||
mtr_im_terminate($im);
|
||||
|
||||
# Check that all processes died.
|
||||
|
||||
unless ( mtr_im_check_alive($im) )
|
||||
{
|
||||
mtr_debug("Instance Manager has been stopped successfully.");
|
||||
mtr_im_cleanup($im);
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Instance Manager don't want to die. We should kill it.
|
||||
|
||||
mtr_im_errlog("Instance Manager did not shutdown gracefully.");
|
||||
|
||||
mtr_im_kill($im);
|
||||
|
||||
# Check again that all IM-related processes have been killed.
|
||||
|
||||
my $im_is_alive= mtr_im_check_alive($im);
|
||||
|
||||
mtr_im_cleanup($im);
|
||||
|
||||
if ( $im_is_alive )
|
||||
{
|
||||
mtr_debug("Can not kill Instance Manager or its children.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
mtr_debug("Instance Manager has been killed successfully.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
1;
|
|
@ -12,6 +12,7 @@ sub mtr_fromfile ($);
|
|||
sub mtr_tofile ($@);
|
||||
sub mtr_tonewfile($@);
|
||||
sub mtr_lastlinefromfile($);
|
||||
sub mtr_appendfile_to_file ($$);
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
|
@ -170,4 +171,17 @@ sub mtr_tonewfile ($@) {
|
|||
close FILE;
|
||||
}
|
||||
|
||||
sub mtr_appendfile_to_file ($$) {
|
||||
my $from_file= shift;
|
||||
my $to_file= shift;
|
||||
|
||||
open(TOFILE,">>",$to_file) or mtr_error("can't open file \"$to_file\": $!");
|
||||
open(FROMFILE,">>",$from_file)
|
||||
or mtr_error("can't open file \"$from_file\": $!");
|
||||
print TOFILE while (<FROMFILE>);
|
||||
close FROMFILE;
|
||||
close TOFILE;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
# and is part of the translation of the Bourne shell script with the
|
||||
# same name.
|
||||
|
||||
#use Carp qw(cluck);
|
||||
use Socket;
|
||||
use Errno;
|
||||
use strict;
|
||||
|
@ -26,28 +25,6 @@ sub mtr_kill_processes ($);
|
|||
sub mtr_ping_with_timeout($);
|
||||
sub mtr_ping_port ($);
|
||||
|
||||
# Private IM-related operations.
|
||||
|
||||
sub mtr_im_kill_process ($$$);
|
||||
sub mtr_im_load_pids ($);
|
||||
sub mtr_im_terminate ($);
|
||||
sub mtr_im_check_alive ($);
|
||||
sub mtr_im_check_main_alive ($);
|
||||
sub mtr_im_check_angel_alive ($);
|
||||
sub mtr_im_check_mysqlds_alive ($);
|
||||
sub mtr_im_check_mysqld_alive ($$);
|
||||
sub mtr_im_cleanup ($);
|
||||
sub mtr_im_rm_file ($);
|
||||
sub mtr_im_errlog ($);
|
||||
sub mtr_im_kill ($);
|
||||
sub mtr_im_wait_for_connection ($$$);
|
||||
sub mtr_im_wait_for_mysqld($$$);
|
||||
|
||||
# Public IM-related operations.
|
||||
|
||||
sub mtr_im_start ($$);
|
||||
sub mtr_im_stop ($$);
|
||||
|
||||
# static in C
|
||||
sub spawn_impl ($$$$$$$$);
|
||||
|
||||
|
@ -115,8 +92,6 @@ sub spawn_impl ($$$$$$$$) {
|
|||
my $pid_file= shift; # FIXME
|
||||
my $spawn_opts= shift;
|
||||
|
||||
mtr_error("Can't spawn with empty \"path\"") unless defined $path;
|
||||
|
||||
if ( $::opt_script_debug )
|
||||
{
|
||||
print STDERR "\n";
|
||||
|
@ -140,6 +115,9 @@ sub spawn_impl ($$$$$$$$) {
|
|||
print STDERR "#### ", "-" x 78, "\n";
|
||||
}
|
||||
|
||||
mtr_error("Can't spawn with empty \"path\"") unless defined $path;
|
||||
|
||||
|
||||
FORK:
|
||||
{
|
||||
my $pid= fork();
|
||||
|
@ -358,9 +336,16 @@ sub mtr_process_exit_status {
|
|||
# kill IM manager first, else it will restart the servers
|
||||
sub mtr_kill_leftovers () {
|
||||
|
||||
mtr_report("Killing Possible Leftover Processes");
|
||||
mtr_debug("mtr_kill_leftovers(): started.");
|
||||
|
||||
mtr_im_stop($::instance_manager, 'mtr_kill_leftovers');
|
||||
mkpath("$::opt_vardir/log"); # Needed for mysqladmin log
|
||||
|
||||
# Stop or kill Instance Manager and all its children. If we failed to do
|
||||
# that, we can only abort -- there is nothing left to do.
|
||||
|
||||
# mtr_error("Failed to stop Instance Manager.")
|
||||
# unless mtr_im_stop($::instance_manager);
|
||||
|
||||
# Start shutdown of masters and slaves. Don't touch IM-managed mysqld
|
||||
# instances -- they should be stopped by mtr_im_stop().
|
||||
|
@ -392,40 +377,41 @@ sub mtr_kill_leftovers () {
|
|||
$srv->{'pid'}= 0; # Assume we are done with it
|
||||
}
|
||||
|
||||
# Start shutdown of clusters.
|
||||
|
||||
mtr_debug("Shutting down cluster...");
|
||||
|
||||
foreach my $cluster (@{$::clusters})
|
||||
if ( ! $::opt_skip_ndbcluster )
|
||||
{
|
||||
mtr_debug(" - cluster " .
|
||||
"(pid: $cluster->{pid}; " .
|
||||
"pid file: '$cluster->{path_pid})");
|
||||
# Start shutdown of clusters.
|
||||
mtr_debug("Shutting down cluster...");
|
||||
|
||||
my $pid= mtr_ndbmgm_start($cluster, "shutdown");
|
||||
|
||||
# Save the pid of the ndb_mgm process
|
||||
$admin_pids{$pid}= 1;
|
||||
|
||||
push(@kill_pids,{
|
||||
pid => $cluster->{'pid'},
|
||||
pidfile => $cluster->{'path_pid'}
|
||||
});
|
||||
|
||||
$cluster->{'pid'}= 0; # Assume we are done with it
|
||||
|
||||
|
||||
foreach my $ndbd (@{$cluster->{'ndbds'}})
|
||||
foreach my $cluster (@{$::clusters})
|
||||
{
|
||||
mtr_debug(" - ndbd " .
|
||||
"(pid: $ndbd->{pid}; " .
|
||||
"pid file: '$ndbd->{path_pid})");
|
||||
mtr_debug(" - cluster " .
|
||||
"(pid: $cluster->{pid}; " .
|
||||
"pid file: '$cluster->{path_pid})");
|
||||
|
||||
my $pid= mtr_ndbmgm_start($cluster, "shutdown");
|
||||
|
||||
# Save the pid of the ndb_mgm process
|
||||
$admin_pids{$pid}= 1;
|
||||
|
||||
push(@kill_pids,{
|
||||
pid => $ndbd->{'pid'},
|
||||
pidfile => $ndbd->{'path_pid'},
|
||||
pid => $cluster->{'pid'},
|
||||
pidfile => $cluster->{'path_pid'}
|
||||
});
|
||||
$ndbd->{'pid'}= 0; # Assume we are done with it
|
||||
|
||||
$cluster->{'pid'}= 0; # Assume we are done with it
|
||||
|
||||
foreach my $ndbd (@{$cluster->{'ndbds'}})
|
||||
{
|
||||
mtr_debug(" - ndbd " .
|
||||
"(pid: $ndbd->{pid}; " .
|
||||
"pid file: '$ndbd->{path_pid})");
|
||||
|
||||
push(@kill_pids,{
|
||||
pid => $ndbd->{'pid'},
|
||||
pidfile => $ndbd->{'path_pid'},
|
||||
});
|
||||
$ndbd->{'pid'}= 0; # Assume we are done with it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1095,7 +1081,7 @@ sub mtr_kill_processes ($) {
|
|||
{
|
||||
foreach my $sig (15, 9)
|
||||
{
|
||||
last if mtr_im_kill_process([ $pid ], $sig, 10);
|
||||
last if mtr_im_kill_process([ $pid ], $sig, 10, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1130,679 +1116,6 @@ sub mtr_exit ($) {
|
|||
exit($code);
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Instance Manager management routines.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub mtr_im_kill_process ($$$) {
|
||||
my $pid_lst= shift;
|
||||
my $signal= shift;
|
||||
my $timeout= shift;
|
||||
my $total_attempts= $timeout * 10;
|
||||
|
||||
my %pids;
|
||||
|
||||
foreach my $pid (@{$pid_lst})
|
||||
{
|
||||
$pids{$pid}= 1;
|
||||
}
|
||||
|
||||
for (my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt)
|
||||
{
|
||||
foreach my $pid (keys %pids)
|
||||
{
|
||||
mtr_debug("Sending $signal to $pid...");
|
||||
|
||||
kill($signal, $pid);
|
||||
|
||||
unless (kill (0, $pid))
|
||||
{
|
||||
mtr_debug("Process $pid died.");
|
||||
delete $pids{$pid};
|
||||
}
|
||||
}
|
||||
|
||||
return if scalar keys %pids == 0;
|
||||
|
||||
mtr_debug("Sleeping 100ms waiting for processes to die...");
|
||||
|
||||
select(undef, undef, undef, 0.1);
|
||||
}
|
||||
|
||||
mtr_debug("Process(es) " .
|
||||
join(' ', keys %pids) .
|
||||
" is still alive after $total_attempts " .
|
||||
"of sending signal $signal.");
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_load_pids($) {
|
||||
my $instance_manager= shift;
|
||||
|
||||
mtr_debug("Loading PID files...");
|
||||
|
||||
# Obtain mysqld-process pids.
|
||||
|
||||
my $instances = $instance_manager->{'instances'};
|
||||
|
||||
for (my $idx= 0; $idx < 2; ++$idx)
|
||||
{
|
||||
mtr_debug("IM-guarded mysqld[$idx] PID file: '" .
|
||||
$instances->[$idx]->{'path_pid'} . "'.");
|
||||
|
||||
my $mysqld_pid;
|
||||
|
||||
if (-r $instances->[$idx]->{'path_pid'})
|
||||
{
|
||||
$mysqld_pid= mtr_get_pid_from_file($instances->[$idx]->{'path_pid'});
|
||||
mtr_debug("IM-guarded mysqld[$idx] PID: $mysqld_pid.");
|
||||
}
|
||||
else
|
||||
{
|
||||
$mysqld_pid= undef;
|
||||
mtr_debug("IM-guarded mysqld[$idx]: no PID file.");
|
||||
}
|
||||
|
||||
$instances->[$idx]->{'pid'}= $mysqld_pid;
|
||||
}
|
||||
|
||||
# Re-read Instance Manager PIDs from the file, since during tests Instance
|
||||
# Manager could have been restarted, so its PIDs could have been changed.
|
||||
|
||||
# - IM-main
|
||||
|
||||
mtr_debug("IM-main PID file: '$instance_manager->{path_pid}'.");
|
||||
|
||||
if (-f $instance_manager->{'path_pid'})
|
||||
{
|
||||
$instance_manager->{'pid'} =
|
||||
mtr_get_pid_from_file($instance_manager->{'path_pid'});
|
||||
|
||||
mtr_debug("IM-main PID: $instance_manager->{pid}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-main: no PID file.");
|
||||
$instance_manager->{'pid'}= undef;
|
||||
}
|
||||
|
||||
# - IM-angel
|
||||
|
||||
mtr_debug("IM-angel PID file: '$instance_manager->{path_angel_pid}'.");
|
||||
|
||||
if (-f $instance_manager->{'path_angel_pid'})
|
||||
{
|
||||
$instance_manager->{'angel_pid'} =
|
||||
mtr_get_pid_from_file($instance_manager->{'path_angel_pid'});
|
||||
|
||||
mtr_debug("IM-angel PID: $instance_manager->{'angel_pid'}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-angel: no PID file.");
|
||||
$instance_manager->{'angel_pid'} = undef;
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_terminate($) {
|
||||
my $instance_manager= shift;
|
||||
|
||||
# Load pids from pid-files. We should do it first of all, because IM deletes
|
||||
# them on shutdown.
|
||||
|
||||
mtr_im_load_pids($instance_manager);
|
||||
|
||||
mtr_debug("Shutting Instance Manager down...");
|
||||
|
||||
# Ignoring SIGCHLD so that all children could rest in peace.
|
||||
|
||||
start_reap_all();
|
||||
|
||||
# Send SIGTERM to IM-main.
|
||||
|
||||
if (defined $instance_manager->{'pid'})
|
||||
{
|
||||
mtr_debug("IM-main pid: $instance_manager->{pid}.");
|
||||
mtr_debug("Stopping IM-main...");
|
||||
|
||||
mtr_im_kill_process([ $instance_manager->{'pid'} ], 'TERM', 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-main pid: n/a.");
|
||||
}
|
||||
|
||||
# If IM-angel was alive, wait for it to die.
|
||||
|
||||
if (defined $instance_manager->{'angel_pid'})
|
||||
{
|
||||
mtr_debug("IM-angel pid: $instance_manager->{'angel_pid'}.");
|
||||
mtr_debug("Waiting for IM-angel to die...");
|
||||
|
||||
my $total_attempts= 10;
|
||||
|
||||
for (my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt)
|
||||
{
|
||||
unless (kill (0, $instance_manager->{'angel_pid'}))
|
||||
{
|
||||
mtr_debug("IM-angel died.");
|
||||
last;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-angel pid: n/a.");
|
||||
}
|
||||
|
||||
stop_reap_all();
|
||||
|
||||
# Re-load PIDs.
|
||||
|
||||
mtr_im_load_pids($instance_manager);
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_check_alive($) {
|
||||
my $instance_manager= shift;
|
||||
|
||||
mtr_debug("Checking whether IM-components are alive...");
|
||||
|
||||
return 1 if mtr_im_check_main_alive($instance_manager);
|
||||
|
||||
return 1 if mtr_im_check_angel_alive($instance_manager);
|
||||
|
||||
return 1 if mtr_im_check_mysqlds_alive($instance_manager);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_check_main_alive($) {
|
||||
my $instance_manager= shift;
|
||||
|
||||
# Check that the process, that we know to be IM's, is dead.
|
||||
|
||||
if (defined $instance_manager->{'pid'})
|
||||
{
|
||||
if (kill (0, $instance_manager->{'pid'}))
|
||||
{
|
||||
mtr_debug("IM-main (PID: $instance_manager->{pid}) is alive.");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-main (PID: $instance_manager->{pid}) is dead.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("No PID file for IM-main.");
|
||||
}
|
||||
|
||||
# Check that IM does not accept client connections.
|
||||
|
||||
if (mtr_ping_port($instance_manager->{'port'}))
|
||||
{
|
||||
mtr_debug("IM-main (port: $instance_manager->{port}) " .
|
||||
"is accepting connections.");
|
||||
|
||||
mtr_im_errlog("IM-main is accepting connections on port " .
|
||||
"$instance_manager->{port}, but there is no " .
|
||||
"process information.");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-main (port: $instance_manager->{port}) " .
|
||||
"does not accept connections.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_check_angel_alive($) {
|
||||
my $instance_manager= shift;
|
||||
|
||||
# Check that the process, that we know to be the Angel, is dead.
|
||||
|
||||
if (defined $instance_manager->{'angel_pid'})
|
||||
{
|
||||
if (kill (0, $instance_manager->{'angel_pid'}))
|
||||
{
|
||||
mtr_debug("IM-angel (PID: $instance_manager->{angel_pid}) is alive.");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-angel (PID: $instance_manager->{angel_pid}) is dead.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("No PID file for IM-angel.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_check_mysqlds_alive($) {
|
||||
my $instance_manager= shift;
|
||||
|
||||
mtr_debug("Checking for IM-guarded mysqld instances...");
|
||||
|
||||
my $instances = $instance_manager->{'instances'};
|
||||
|
||||
for (my $idx= 0; $idx < 2; ++$idx)
|
||||
{
|
||||
mtr_debug("Checking mysqld[$idx]...");
|
||||
|
||||
return 1
|
||||
if mtr_im_check_mysqld_alive($instance_manager, $instances->[$idx]);
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_check_mysqld_alive($$) {
|
||||
my $instance_manager= shift;
|
||||
my $mysqld_instance= shift;
|
||||
|
||||
# Check that the process is dead.
|
||||
|
||||
if (defined $instance_manager->{'pid'})
|
||||
{
|
||||
if (kill (0, $instance_manager->{'pid'}))
|
||||
{
|
||||
mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is alive.");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is dead.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("No PID file for mysqld instance.");
|
||||
}
|
||||
|
||||
# Check that mysqld does not accept client connections.
|
||||
|
||||
if (mtr_ping_port($mysqld_instance->{'port'}))
|
||||
{
|
||||
mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
|
||||
"is accepting connections.");
|
||||
|
||||
mtr_im_errlog("Mysqld is accepting connections on port " .
|
||||
"$mysqld_instance->{port}, but there is no " .
|
||||
"process information.");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
|
||||
"does not accept connections.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_cleanup($) {
|
||||
my $instance_manager= shift;
|
||||
|
||||
mtr_im_rm_file($instance_manager->{'path_pid'});
|
||||
mtr_im_rm_file($instance_manager->{'path_sock'});
|
||||
|
||||
mtr_im_rm_file($instance_manager->{'path_angel_pid'});
|
||||
|
||||
for (my $idx= 0; $idx < 2; ++$idx)
|
||||
{
|
||||
mtr_im_rm_file($instance_manager->{'instances'}->[$idx]->{'path_pid'});
|
||||
mtr_im_rm_file($instance_manager->{'instances'}->[$idx]->{'path_sock'});
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_rm_file($)
|
||||
{
|
||||
my $file_path= shift;
|
||||
|
||||
if (-f $file_path)
|
||||
{
|
||||
mtr_debug("Removing '$file_path'...");
|
||||
|
||||
mtr_warning("Can not remove '$file_path'.")
|
||||
unless unlink($file_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("File '$file_path' does not exist already.");
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_errlog($) {
|
||||
my $msg= shift;
|
||||
|
||||
# Complain in error log so that a warning will be shown.
|
||||
#
|
||||
# TODO: unless BUG#20761 is fixed, we will print the warning to stdout, so
|
||||
# that it can be seen on console and does not produce pushbuild error.
|
||||
|
||||
# my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
|
||||
#
|
||||
# open (ERRLOG, ">>$errlog") ||
|
||||
# mtr_error("Can not open error log ($errlog)");
|
||||
#
|
||||
# my $ts= localtime();
|
||||
# print ERRLOG
|
||||
# "Warning: [$ts] $msg\n";
|
||||
#
|
||||
# close ERRLOG;
|
||||
|
||||
my $ts= localtime();
|
||||
print "Warning: [$ts] $msg\n";
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
sub mtr_im_kill($) {
|
||||
my $instance_manager= shift;
|
||||
|
||||
# Re-load PIDs. That can be useful because some processes could have been
|
||||
# restarted.
|
||||
|
||||
mtr_im_load_pids($instance_manager);
|
||||
|
||||
# Ignoring SIGCHLD so that all children could rest in peace.
|
||||
|
||||
start_reap_all();
|
||||
|
||||
# Kill IM-angel first of all.
|
||||
|
||||
if (defined $instance_manager->{'angel_pid'})
|
||||
{
|
||||
mtr_debug("Killing IM-angel (PID: $instance_manager->{angel_pid})...");
|
||||
mtr_im_kill_process([ $instance_manager->{'angel_pid'} ], 'KILL', 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-angel is dead.");
|
||||
}
|
||||
|
||||
# Re-load PIDs again.
|
||||
|
||||
mtr_im_load_pids($instance_manager);
|
||||
|
||||
# Kill IM-main.
|
||||
|
||||
if (defined $instance_manager->{'pid'})
|
||||
{
|
||||
mtr_debug("Killing IM-main (PID: $instance_manager->pid})...");
|
||||
mtr_im_kill_process([ $instance_manager->{'pid'} ], 'KILL', 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM-main is dead.");
|
||||
}
|
||||
|
||||
# Re-load PIDs again.
|
||||
|
||||
mtr_im_load_pids($instance_manager);
|
||||
|
||||
# Kill guarded mysqld instances.
|
||||
|
||||
my @mysqld_pids;
|
||||
|
||||
mtr_debug("Collecting PIDs of mysqld instances to kill...");
|
||||
|
||||
for (my $idx= 0; $idx < 2; ++$idx)
|
||||
{
|
||||
my $pid= $instance_manager->{'instances'}->[$idx]->{'pid'};
|
||||
|
||||
next unless defined $pid;
|
||||
|
||||
mtr_debug(" - IM-guarded mysqld[$idx] PID: $pid.");
|
||||
|
||||
push (@mysqld_pids, $pid);
|
||||
}
|
||||
|
||||
if (scalar @mysqld_pids > 0)
|
||||
{
|
||||
mtr_debug("Killing IM-guarded mysqld instances...");
|
||||
mtr_im_kill_process(\@mysqld_pids, 'KILL', 10);
|
||||
}
|
||||
|
||||
# That's all.
|
||||
|
||||
stop_reap_all();
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
sub mtr_im_wait_for_connection($$$) {
|
||||
my $instance_manager= shift;
|
||||
my $total_attempts= shift;
|
||||
my $connect_timeout= shift;
|
||||
|
||||
mtr_debug("Waiting for IM on port $instance_manager->{port} " .
|
||||
"to start accepting connections...");
|
||||
|
||||
for (my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt)
|
||||
{
|
||||
mtr_debug("Trying to connect to IM ($cur_attempt of $total_attempts)...");
|
||||
|
||||
if (mtr_ping_port($instance_manager->{'port'}))
|
||||
{
|
||||
mtr_debug("IM is accepting connections " .
|
||||
"on port $instance_manager->{port}.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
mtr_debug("Sleeping $connect_timeout...");
|
||||
sleep($connect_timeout);
|
||||
}
|
||||
|
||||
mtr_debug("IM does not accept connections " .
|
||||
"on port $instance_manager->{port} after " .
|
||||
($total_attempts * $connect_timeout) . " seconds.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
sub mtr_im_wait_for_mysqld($$$) {
|
||||
my $mysqld= shift;
|
||||
my $total_attempts= shift;
|
||||
my $connect_timeout= shift;
|
||||
|
||||
mtr_debug("Waiting for IM-guarded mysqld on port $mysqld->{port} " .
|
||||
"to start accepting connections...");
|
||||
|
||||
for (my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt)
|
||||
{
|
||||
mtr_debug("Trying to connect to mysqld " .
|
||||
"($cur_attempt of $total_attempts)...");
|
||||
|
||||
if (mtr_ping_port($mysqld->{'port'}))
|
||||
{
|
||||
mtr_debug("Mysqld is accepting connections " .
|
||||
"on port $mysqld->{port}.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
mtr_debug("Sleeping $connect_timeout...");
|
||||
sleep($connect_timeout);
|
||||
}
|
||||
|
||||
mtr_debug("Mysqld does not accept connections " .
|
||||
"on port $mysqld->{port} after " .
|
||||
($total_attempts * $connect_timeout) . " seconds.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
sub mtr_im_start($$) {
|
||||
my $instance_manager = shift;
|
||||
my $opts = shift;
|
||||
|
||||
mtr_debug("Starting Instance Manager...");
|
||||
|
||||
my $args;
|
||||
mtr_init_args(\$args);
|
||||
mtr_add_arg($args, "--defaults-file=%s",
|
||||
$instance_manager->{'defaults_file'});
|
||||
|
||||
foreach my $opt (@{$opts})
|
||||
{
|
||||
mtr_add_arg($args, $opt);
|
||||
}
|
||||
|
||||
$instance_manager->{'pid'} =
|
||||
mtr_spawn(
|
||||
$::exe_im, # path to the executable
|
||||
$args, # cmd-line args
|
||||
'', # stdin
|
||||
$instance_manager->{'path_log'}, # stdout
|
||||
$instance_manager->{'path_err'}, # stderr
|
||||
'', # pid file path (not used)
|
||||
{ append_log_file => 1 } # append log files
|
||||
);
|
||||
|
||||
if ( ! $instance_manager->{'pid'} )
|
||||
{
|
||||
mtr_report('Could not start Instance Manager');
|
||||
return;
|
||||
}
|
||||
|
||||
# Instance Manager can be run in daemon mode. In this case, it creates
|
||||
# several processes and the parent process, created by mtr_spawn(), exits just
|
||||
# after start. So, we have to obtain Instance Manager PID from the PID file.
|
||||
|
||||
if ( ! sleep_until_file_created(
|
||||
$instance_manager->{'path_pid'},
|
||||
$instance_manager->{'start_timeout'},
|
||||
-1)) # real PID is still unknown
|
||||
{
|
||||
mtr_report("Instance Manager PID file is missing");
|
||||
return;
|
||||
}
|
||||
|
||||
$instance_manager->{'pid'} =
|
||||
mtr_get_pid_from_file($instance_manager->{'path_pid'});
|
||||
|
||||
mtr_debug("Instance Manager started. PID: $instance_manager->{pid}.");
|
||||
|
||||
# Wait until we can connect to IM.
|
||||
|
||||
my $IM_CONNECT_TIMEOUT= 30;
|
||||
|
||||
unless (mtr_im_wait_for_connection($instance_manager,
|
||||
$IM_CONNECT_TIMEOUT, 1))
|
||||
{
|
||||
mtr_debug("Can not connect to Instance Manager " .
|
||||
"in $IM_CONNECT_TIMEOUT seconds after start.");
|
||||
mtr_debug("Aborting test suite...");
|
||||
|
||||
mtr_kill_leftovers();
|
||||
|
||||
mtr_error("Can not connect to Instance Manager " .
|
||||
"in $IM_CONNECT_TIMEOUT seconds after start.");
|
||||
}
|
||||
|
||||
# Wait until we can connect to guarded mysqld-instances
|
||||
# (in other words -- wait for IM to start guarded instances).
|
||||
|
||||
for (my $idx= 0; $idx < 2; ++$idx)
|
||||
{
|
||||
my $mysqld= $instance_manager->{'instances'}->[$idx];
|
||||
|
||||
next if exists $mysqld->{'nonguarded'};
|
||||
|
||||
mtr_debug("Waiting for mysqld[$idx] to start...");
|
||||
|
||||
unless (mtr_im_wait_for_mysqld($mysqld, 30, 1))
|
||||
{
|
||||
mtr_debug("Can not connect to mysqld[$idx] " .
|
||||
"in $IM_CONNECT_TIMEOUT seconds after start.");
|
||||
mtr_debug("Aborting test suite...");
|
||||
|
||||
mtr_kill_leftovers();
|
||||
|
||||
mtr_error("Can not connect to mysqld[$idx] " .
|
||||
"in $IM_CONNECT_TIMEOUT seconds after start.");
|
||||
}
|
||||
|
||||
mtr_debug("mysqld[$idx] started.");
|
||||
}
|
||||
|
||||
mtr_debug("Instance Manager started.");
|
||||
|
||||
mtr_im_load_pids($instance_manager);
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
sub mtr_im_stop($$) {
|
||||
my $instance_manager= shift;
|
||||
my $where= shift;
|
||||
|
||||
mtr_debug("Stopping Instance Manager...");
|
||||
|
||||
# Try graceful shutdown.
|
||||
|
||||
mtr_im_terminate($instance_manager);
|
||||
|
||||
# Check that all processes died.
|
||||
|
||||
unless (mtr_im_check_alive($instance_manager))
|
||||
{
|
||||
mtr_debug("Instance Manager has been stopped successfully.");
|
||||
mtr_im_cleanup($instance_manager);
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Instance Manager don't want to die. We should kill it.
|
||||
|
||||
mtr_im_errlog("[$where] Instance Manager did not shutdown gracefully.");
|
||||
|
||||
mtr_im_kill($instance_manager);
|
||||
|
||||
# Check again that all IM-related processes have been killed.
|
||||
|
||||
my $im_is_alive= mtr_im_check_alive($instance_manager);
|
||||
|
||||
mtr_im_cleanup($instance_manager);
|
||||
|
||||
if ($im_is_alive)
|
||||
{
|
||||
mtr_error("Can not kill Instance Manager or its children.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
mtr_debug("Instance Manager has been killed successfully.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
1;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -195,7 +195,7 @@ select (@before:=unix_timestamp())*0;
|
|||
(@before:=unix_timestamp())*0
|
||||
0
|
||||
begin;
|
||||
select * from t1 for update;
|
||||
select * from t1 for update;
|
||||
insert into t2 values (20);
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select (@after:=unix_timestamp())*0;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
drop table if exists t1;
|
||||
create table t1(n int not null, key(n), key(n), key(n), key(n));
|
||||
check table t1 extended;
|
||||
check table t1 extended;
|
||||
insert into t1 values (200000);
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
|
|
|
@ -79,9 +79,9 @@ drop table if exists t1;
|
|||
create table t1 (i int);
|
||||
lock tables t1 read;
|
||||
create database mysqltest;
|
||||
drop table t1;
|
||||
drop table t1;
|
||||
show open tables;
|
||||
drop database mysqltest;
|
||||
drop database mysqltest;
|
||||
select 1;
|
||||
1
|
||||
1
|
||||
|
|
|
@ -9,13 +9,13 @@ n
|
|||
flush tables with read lock;
|
||||
drop table t2;
|
||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||
drop table t2;
|
||||
drop table t2;
|
||||
unlock tables;
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1(n int);
|
||||
insert into mysqltest.t1 values (23);
|
||||
flush tables with read lock;
|
||||
drop database mysqltest;
|
||||
drop database mysqltest;
|
||||
select * from mysqltest.t1;
|
||||
n
|
||||
23
|
||||
|
@ -51,7 +51,7 @@ drop table t1, t2, t3;
|
|||
create table t1 (c1 int);
|
||||
create table t2 (c1 int);
|
||||
lock table t1 write;
|
||||
flush tables with read lock;
|
||||
insert into t2 values(1);
|
||||
flush tables with read lock;
|
||||
insert into t2 values(1);
|
||||
unlock tables;
|
||||
drop table t1, t2;
|
||||
|
|
|
@ -5,7 +5,7 @@ insert into t1 values(1);
|
|||
flush tables with read lock;
|
||||
select * from t1;
|
||||
a
|
||||
commit;
|
||||
commit;
|
||||
select * from t1;
|
||||
a
|
||||
unlock tables;
|
||||
|
@ -14,8 +14,8 @@ select * from t1 for update;
|
|||
a
|
||||
1
|
||||
begin;
|
||||
select * from t1 for update;
|
||||
flush tables with read lock;
|
||||
select * from t1 for update;
|
||||
flush tables with read lock;
|
||||
commit;
|
||||
a
|
||||
1
|
||||
|
@ -45,7 +45,7 @@ flush tables with read lock;
|
|||
show master status;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 102
|
||||
commit;
|
||||
commit;
|
||||
show master status;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 102
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
drop table if exists t1;
|
||||
create table t1 (kill_id int);
|
||||
insert into t1 values(connection_id());
|
||||
flush tables with read lock;
|
||||
flush tables with read lock;
|
||||
select ((@id := kill_id) - kill_id) from t1;
|
||||
((@id := kill_id) - kill_id)
|
||||
0
|
||||
|
|
|
@ -63,7 +63,7 @@ FROM t1
|
|||
WHERE conn = 'default';
|
||||
IS_USED_LOCK('bug16501') = connection_id
|
||||
1
|
||||
SELECT GET_LOCK('bug16501',600);
|
||||
SELECT GET_LOCK('bug16501',600);
|
||||
SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
|
||||
IS_USED_LOCK('bug16501') = CONNECTION_ID()
|
||||
1
|
||||
|
|
|
@ -336,12 +336,12 @@ drop database mysqltest_1;
|
|||
set password = password("changed");
|
||||
ERROR 42000: Access denied for user ''@'localhost' to database 'mysql'
|
||||
lock table mysql.user write;
|
||||
flush privileges;
|
||||
grant all on *.* to 'mysqltest_1'@'localhost';
|
||||
flush privileges;
|
||||
grant all on *.* to 'mysqltest_1'@'localhost';
|
||||
unlock tables;
|
||||
lock table mysql.user write;
|
||||
set password for 'mysqltest_1'@'localhost' = password('');
|
||||
revoke all on *.* from 'mysqltest_1'@'localhost';
|
||||
set password for 'mysqltest_1'@'localhost' = password('');
|
||||
revoke all on *.* from 'mysqltest_1'@'localhost';
|
||||
unlock tables;
|
||||
drop user 'mysqltest_1'@'localhost';
|
||||
create database TESTDB;
|
||||
|
|
|
@ -476,7 +476,7 @@ handler t1 read first;
|
|||
c1
|
||||
1
|
||||
send the below to another connection, do not wait for the result
|
||||
optimize table t1;
|
||||
optimize table t1;
|
||||
proceed with the normal connection
|
||||
handler t1 read next;
|
||||
c1
|
||||
|
@ -502,7 +502,7 @@ flush tables with read lock;
|
|||
drop table t1;
|
||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||
send the below to another connection, do not wait for the result
|
||||
drop table t1;
|
||||
drop table t1;
|
||||
proceed with the normal connection
|
||||
select * from t1;
|
||||
c1
|
||||
|
|
|
@ -10,7 +10,7 @@ start transaction;
|
|||
select f1();
|
||||
f1()
|
||||
100
|
||||
update t1 set col2=0 where col1=1;
|
||||
update t1 set col2=0 where col1=1;
|
||||
select * from t1;
|
||||
col1 col2
|
||||
1 100
|
||||
|
|
|
@ -22,7 +22,7 @@ create table t2 (id int unsigned not null);
|
|||
insert into t2 select id from t1;
|
||||
create table t3 (kill_id int);
|
||||
insert into t3 values(connection_id());
|
||||
select id from t1 where id in (select distinct id from t2);
|
||||
select id from t1 where id in (select distinct id from t2);
|
||||
select ((@id := kill_id) - kill_id) from t3;
|
||||
((@id := kill_id) - kill_id)
|
||||
0
|
||||
|
@ -32,7 +32,7 @@ drop table t1, t2, t3;
|
|||
select get_lock("a", 10);
|
||||
get_lock("a", 10)
|
||||
1
|
||||
select get_lock("a", 10);
|
||||
select get_lock("a", 10);
|
||||
get_lock("a", 10)
|
||||
NULL
|
||||
select 1;
|
||||
|
|
|
@ -509,8 +509,8 @@ create table t2 (a int);
|
|||
insert into t2 values (10), (20), (30);
|
||||
create view v1 as select a as b, a/10 as a from t2;
|
||||
lock table t1 write;
|
||||
alter table t1 add column c int default 100 after a;
|
||||
update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a;
|
||||
alter table t1 add column c int default 100 after a;
|
||||
update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a;
|
||||
unlock tables;
|
||||
select * from t1;
|
||||
a c b
|
||||
|
|
|
@ -154,6 +154,19 @@ mysqltest: At line 1: End of line junk detected: "sleep 7
|
|||
"
|
||||
mysqltest: At line 1: Extra delimiter ";" found
|
||||
mysqltest: At line 1: Extra delimiter ";" found
|
||||
mysqltest: At line 1: Missing argument(s) to 'error'
|
||||
mysqltest: At line 1: Missing argument(s) to 'error'
|
||||
mysqltest: At line 1: The sqlstate definition must start with an uppercase S
|
||||
mysqltest: At line 1: The error name definition must start with an uppercase E
|
||||
mysqltest: At line 1: Invalid argument to error: '9eeeee' - the errno may only consist of digits[0-9]
|
||||
mysqltest: At line 1: Invalid argument to error: '1sssss' - the errno may only consist of digits[0-9]
|
||||
mysqltest: At line 1: The sqlstate must be exactly 5 chars long
|
||||
mysqltest: At line 1: The sqlstate may only consist of digits[0-9] and _uppercase_ letters
|
||||
mysqltest: At line 1: The sqlstate must be exactly 5 chars long
|
||||
mysqltest: At line 1: Unknown SQL error name 'E9999'
|
||||
mysqltest: At line 1: Invalid argument to error: '999e9' - the errno may only consist of digits[0-9]
|
||||
mysqltest: At line 1: Invalid argument to error: '9b' - the errno may only consist of digits[0-9]
|
||||
mysqltest: At line 1: Too many errorcodes specified
|
||||
MySQL
|
||||
"MySQL"
|
||||
MySQL: The world''s most popular open source database
|
||||
|
@ -239,7 +252,7 @@ mysqltest: At line 1: Missing assignment operator in let
|
|||
1
|
||||
# Execute: echo $success ;
|
||||
1
|
||||
mysqltest: At line 1: Missing file name in source
|
||||
mysqltest: At line 1: Missing required argument 'filename' to command 'source'
|
||||
mysqltest: At line 1: Could not open file ./non_existingFile
|
||||
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep
|
||||
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
|
||||
|
@ -332,7 +345,7 @@ Counter is greater than 0, (counter=10)
|
|||
Counter is not 0, (counter=0)
|
||||
1
|
||||
Testing while with not
|
||||
mysqltest: In included file "./include/mysqltest_while.inc": At line 64: Nesting too deeply
|
||||
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest_while.inc": At line 64: Nesting too deeply
|
||||
mysqltest: At line 1: missing '(' in while
|
||||
mysqltest: At line 1: missing ')' in while
|
||||
mysqltest: At line 1: Missing '{' after while. Found "dec $i"
|
||||
|
@ -371,17 +384,15 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1
|
|||
mysqltest: At line 1: Invalid integer argument "10!"
|
||||
mysqltest: At line 1: End of line junk detected: "!"
|
||||
mysqltest: At line 1: Invalid integer argument "a"
|
||||
mysqltest: At line 1: Syntax error in connect - expected '(' found 'mysqltest: At line 1: Missing connection host
|
||||
mysqltest: At line 1: Missing connection host
|
||||
mysqltest: At line 1: Missing connection user
|
||||
mysqltest: At line 1: Missing connection user
|
||||
mysqltest: At line 1: Missing connection password
|
||||
mysqltest: At line 1: Missing connection db
|
||||
mysqltest: At line 1: Could not open connection 'con2': 1049 Unknown database 'illegal_db'
|
||||
mysqltest: At line 1: Missing required argument 'connection name' to command 'connect'
|
||||
mysqltest: At line 1: Missing required argument 'connection name' to command 'connect'
|
||||
mysqltest: At line 1: Missing required argument 'host' to command 'connect'
|
||||
mysqltest: At line 1: Missing required argument 'host' to command 'connect'
|
||||
mysqltest: At line 1: query 'connect con2,localhost,root,,illegal_db' failed: 1049: Unknown database 'illegal_db'
|
||||
mysqltest: At line 1: Illegal argument for port: 'illegal_port'
|
||||
mysqltest: At line 1: Illegal option to connect: SMTP
|
||||
OK
|
||||
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 7: Connection limit exhausted - increase MAX_CONS in mysqltest.c
|
||||
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 7: Connection limit exhausted, you can have max 128 connections
|
||||
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool
|
||||
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists
|
||||
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
|
||||
|
@ -449,7 +460,6 @@ sleep;
|
|||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sleep' at line 1
|
||||
;
|
||||
ERROR 42000: Query was empty
|
||||
End of 5.0 tests
|
||||
select "b" as col1, "c" as col2;
|
||||
col1 col2
|
||||
b c
|
||||
|
@ -492,4 +502,3 @@ mysqltest: At line 1: Max delimiter length(16) exceeded
|
|||
hello
|
||||
hello
|
||||
End of tests
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -326,7 +326,7 @@ insert into t1 values(3);
|
|||
set i_var = sleep(3);
|
||||
return 0;
|
||||
end;|
|
||||
select f1();
|
||||
select f1();
|
||||
select sleep(4);
|
||||
sleep(4)
|
||||
0
|
||||
|
|
|
@ -43,7 +43,7 @@ Note 1051 Unknown table 't4'
|
|||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t3 (a int);
|
||||
FLUSH TABLES WITH READ LOCK;
|
||||
RENAME TABLE t1 TO t2, t3 to t4;
|
||||
RENAME TABLE t1 TO t2, t3 to t4;
|
||||
show tables;
|
||||
Tables_in_test
|
||||
t1
|
||||
|
|
|
@ -26,7 +26,7 @@ create table t2 (a int primary key);
|
|||
insert into t2 values(1);
|
||||
create table t3 (id int);
|
||||
insert into t3 values(connection_id());
|
||||
update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
|
||||
update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
|
||||
select (@id := id) - id from t3;
|
||||
(@id := id) - id
|
||||
0
|
||||
|
|
|
@ -12,7 +12,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select master_pos_wait(_latin1'master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
|
||||
select master_pos_wait('master-bin.999999',0);
|
||||
select master_pos_wait('master-bin.999999',0);
|
||||
stop slave sql_thread;
|
||||
master_pos_wait('master-bin.999999',0)
|
||||
NULL
|
||||
|
|
|
@ -44,7 +44,7 @@ create table t2(id int);
|
|||
insert into t2 values(connection_id());
|
||||
create temporary table t3(n int);
|
||||
insert into t3 select get_lock('crash_lock%20C', 1) from t2;
|
||||
update t1 set n = n + get_lock('crash_lock%20C', 2);
|
||||
update t1 set n = n + get_lock('crash_lock%20C', 2);
|
||||
select (@id := id) - id from t2;
|
||||
(@id := id) - id
|
||||
0
|
||||
|
|
|
@ -31,7 +31,7 @@ create procedure bug9486()
|
|||
update t1, t2 set val= 1 where id1=id2;
|
||||
call bug9486();
|
||||
lock tables t2 write;
|
||||
call bug9486();
|
||||
call bug9486();
|
||||
show processlist;
|
||||
Id User Host db Command Time State Info
|
||||
# root localhost test Sleep # NULL
|
||||
|
@ -77,7 +77,7 @@ select * from t1;
|
|||
end|
|
||||
use test;
|
||||
lock table t1 write;
|
||||
call p2();
|
||||
call p2();
|
||||
use test;
|
||||
drop procedure p1;
|
||||
create procedure p1() select * from t1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
drop table if exists t1;
|
||||
CREATE TABLE t1 (x1 int);
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -8,7 +8,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -16,7 +16,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -24,7 +24,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -32,7 +32,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -40,7 +40,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -48,7 +48,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -56,7 +56,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -64,7 +64,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -72,7 +72,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -80,7 +80,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -88,7 +88,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -96,7 +96,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -104,7 +104,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -112,7 +112,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -120,7 +120,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -128,7 +128,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -136,7 +136,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -144,7 +144,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
ALTER TABLE t1 CHANGE x1 x2 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
@ -152,7 +152,7 @@ t2 CREATE TABLE `t2` (
|
|||
`xx` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
ALTER TABLE t1 CHANGE x2 x1 int;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
|
|
|
@ -59,6 +59,7 @@ flush privileges;
|
|||
|
||||
connect (con10,localhost,test,gambling2,);
|
||||
connect (con5,localhost,test,gambling2,mysql);
|
||||
connection con5;
|
||||
set password="";
|
||||
--error 1372
|
||||
set password='gambling3';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
# See mysql-test/std_data/init_file.dat and
|
||||
# mysql-test/t/init_file-master.opt for the actual test
|
||||
#
|
||||
#
|
||||
|
||||
--echo ok
|
||||
--echo end of 4.1 tests
|
||||
|
|
|
@ -317,7 +317,6 @@ select 3 from t1 ;
|
|||
#
|
||||
#select 3 from t1 ;
|
||||
|
||||
# End of 4.1 tests
|
||||
--error 1
|
||||
--exec echo "disable_abort_on_error; enable_abort_on_error; error 1064; select 3 from t1; select 3 from t1;" | $MYSQL_TEST 2>&1
|
||||
|
||||
|
@ -388,6 +387,67 @@ select 3 from t1 ;
|
|||
--sleep 1 # Wait for insert delayed to be executed.
|
||||
--sleep 1 # Wait for insert delayed to be executed.
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test error
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# Missing argument
|
||||
--error 1
|
||||
--exec echo "error;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "--error" | $MYSQL_TEST 2>&1
|
||||
|
||||
# First char must be uppercase 'S' or 'E' or [0-9]
|
||||
--error 1
|
||||
--exec echo "--error s99999" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "--error e99999" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "--error 9eeeee" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "--error 1sssss" | $MYSQL_TEST 2>&1
|
||||
|
||||
# First char 'S' but too long
|
||||
--error 1
|
||||
--exec echo "--error S999999" | $MYSQL_TEST 2>&1
|
||||
|
||||
# First char 'S' but lowercase char found
|
||||
--error 1
|
||||
--exec echo "--error S99a99" | $MYSQL_TEST 2>&1
|
||||
|
||||
# First char 'S' but too short
|
||||
--error 1
|
||||
--exec echo "--error S9999" | $MYSQL_TEST 2>&1
|
||||
|
||||
# First char 'E' but not found in error array
|
||||
--error 1
|
||||
--exec echo "--error E9999" | $MYSQL_TEST 2>&1
|
||||
|
||||
# First char [0-9] but contains chars
|
||||
--error 1
|
||||
--exec echo "--error 999e9" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "--error 9b" | $MYSQL_TEST 2>&1
|
||||
|
||||
# Multiple errorcodes separated by ','
|
||||
--error 1,1,1,1
|
||||
#--error 9,ER_PARSE_ERROR
|
||||
#--error ER_PARSE_ERROR
|
||||
#--error 9,ER_PARSE_ERROR,9,ER_PARSE_ERROR
|
||||
#--error 9, ER_PARSE_ERROR, 9, ER_PARSE_ERROR
|
||||
#--error 9,S00000,9,ER_PARSE_ERROR
|
||||
#--error 9,S00000,9,ER_PARSE_ERROR,ER_PARSE_ERROR,ER_PARSE_ERROR,9,10,11,12
|
||||
--error 9,S00000,9
|
||||
--error 9,S00000,9,9,10,11,12
|
||||
--error 9 ,10
|
||||
--error 9 , 10
|
||||
--error 9 , 10
|
||||
--error 9 , 10
|
||||
|
||||
# Too many errorcodes specified
|
||||
--error 1
|
||||
--exec echo "--error 1,2,3,4,5,6,7,8,9,10,11" | $MYSQL_TEST 2>&1
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test echo command
|
||||
|
@ -610,6 +670,7 @@ echo $var3_var3;
|
|||
|
||||
# Fix win paths
|
||||
--replace_result \\ /
|
||||
# Source a nonexisting file
|
||||
--error 1
|
||||
--exec echo "source non_existingFile;" | $MYSQL_TEST 2>&1
|
||||
|
||||
|
@ -627,13 +688,16 @@ echo $var3_var3;
|
|||
|
||||
|
||||
# Test execution of source in a while loop
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/sourced.inc
|
||||
echo here is the sourced script;
|
||||
EOF
|
||||
--disable_query_log
|
||||
let $outer= 2; # Number of outer loops
|
||||
while ($outer)
|
||||
{
|
||||
eval SELECT '$outer = outer loop variable after while' AS "";
|
||||
|
||||
--source include/sourced.inc
|
||||
--source $MYSQLTEST_VARDIR/tmp/sourced.inc
|
||||
|
||||
eval SELECT '$outer = outer loop variable before dec' AS "";
|
||||
dec $outer;
|
||||
|
@ -661,11 +725,12 @@ let $num= 9;
|
|||
while ($num)
|
||||
{
|
||||
SELECT 'In loop' AS "";
|
||||
--source include/sourced1.inc
|
||||
--source $MYSQLTEST_VARDIR/tmp/sourced.inc
|
||||
dec $num;
|
||||
}
|
||||
--enable_abort_on_error
|
||||
--enable_query_log
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test sleep command
|
||||
|
@ -817,10 +882,150 @@ while (!$i)
|
|||
}
|
||||
|
||||
# Exceed max nesting level
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest_while.inc
|
||||
let $1 = 10;
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
echo $1;
|
||||
dec $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
# Fix win path
|
||||
--replace_result \\ /
|
||||
--replace_result \\ / $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--error 1
|
||||
--exec echo "source include/mysqltest_while.inc;" | $MYSQL_TEST 2>&1
|
||||
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest_while.inc;" | $MYSQL_TEST 2>&1
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/mysqltest_while.inc
|
||||
--error 1
|
||||
--exec echo "while \$i;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
|
@ -925,12 +1130,6 @@ select "a" as col1, "c" as col2;
|
|||
--error 1
|
||||
--exec echo "connect (con2,);" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "connect (con2,localhost);" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "connect (con2, localhost, root);" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "connect (con2, localhost, root,);" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "connect (con2,localhost,root,,illegal_db);" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "connect (con1,localhost,root,,,illegal_port,);" | $MYSQL_TEST 2>&1
|
||||
|
@ -938,13 +1137,15 @@ select "a" as col1, "c" as col2;
|
|||
--exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1
|
||||
|
||||
# Repeat connect/disconnect
|
||||
--system echo "let \$i=100;" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql
|
||||
--system echo "while (\$i)" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
|
||||
--system echo "{" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
|
||||
--system echo " connect (test_con1,localhost,root,,); " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
|
||||
--system echo " disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
|
||||
--system echo " dec \$i; " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
|
||||
--system echo "}" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
|
||||
let $i=100;
|
||||
while ($i)
|
||||
{
|
||||
connect (test_con1,localhost,root,,);
|
||||
disconnect test_con1;
|
||||
dec $i;
|
||||
}
|
||||
EOF
|
||||
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# Repeat connect/disconnect, exceed max number of connections
|
||||
|
@ -1149,8 +1350,6 @@ query sleep;
|
|||
--error 1065
|
||||
query ;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# test for replace_regex
|
||||
--replace_regex /at/b/
|
||||
select "at" as col1, "c" as col2;
|
||||
|
@ -1289,4 +1488,3 @@ EOF
|
|||
|
||||
|
||||
--echo End of tests
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -354,14 +354,14 @@ create table t1 (a int, b int);
|
|||
insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2);
|
||||
prepare stmt from
|
||||
"explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?";
|
||||
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
|
||||
set @v=5;
|
||||
execute stmt using @v;
|
||||
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
|
||||
execute stmt using @v;
|
||||
set @v=0;
|
||||
execute stmt using @v;
|
||||
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
|
||||
execute stmt using @v;
|
||||
set @v=5;
|
||||
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
|
||||
execute stmt using @v;
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
|
|
|
@ -316,8 +316,8 @@ prepare stmt4 from ' show table status from test like ''t9%'' ';
|
|||
--replace_column 8 # 12 # 13 # 14 #
|
||||
# Bug#4288
|
||||
execute stmt4;
|
||||
--replace_column 2 #
|
||||
prepare stmt4 from ' show status like ''Threads_running'' ';
|
||||
--replace_column 2 #
|
||||
execute stmt4;
|
||||
prepare stmt4 from ' show variables like ''sql_mode'' ';
|
||||
execute stmt4;
|
||||
|
|
|
@ -35,7 +35,7 @@ use mysqltest;
|
|||
--source include/ps_create.inc
|
||||
--source include/ps_renew.inc
|
||||
--enable_query_log
|
||||
eval use $DB;
|
||||
use test;
|
||||
grant usage on mysqltest.* to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
grant select on mysqltest.t9 to second_user@localhost
|
||||
|
|
|
@ -319,7 +319,7 @@ begin
|
|||
declare x int;
|
||||
end|
|
||||
|
||||
--error 1332
|
||||
--error 1332
|
||||
create procedure p()
|
||||
begin
|
||||
declare c condition for 1064;
|
||||
|
|
Loading…
Reference in a new issue