diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/lib/mtr_cases.pl | 7 | ||||
-rw-r--r-- | mysql-test/lib/mtr_process.pl | 10 | ||||
-rw-r--r-- | mysql-test/lib/mtr_report.pl | 74 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 48 | ||||
-rw-r--r-- | mysql-test/mysql-test-run.sh | 9 | ||||
-rw-r--r-- | mysql-test/r/im_life_cycle.result | 2 | ||||
-rw-r--r-- | mysql-test/r/ndb_basic.result | 55 | ||||
-rw-r--r-- | mysql-test/t/im_life_cycle.imtest | 9 | ||||
-rw-r--r-- | mysql-test/t/ndb_basic.test | 66 |
9 files changed, 234 insertions, 46 deletions
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 9b265f90452..568b44d2e59 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -111,7 +111,7 @@ sub collect_test_cases ($) { # Disable some tests listed in disabled.def # ---------------------------------------------------------------------- my %disabled; - if ( open(DISABLED, "$testdir/disabled.def" ) ) + if ( ! $::opt_ignore_disabled_def and open(DISABLED, "$testdir/disabled.def" ) ) { while ( <DISABLED> ) { @@ -282,8 +282,8 @@ sub collect_one_test_case($$$$$$$) { my $disabled_file= "$testdir/$tname.disabled"; my $im_opt_file= "$testdir/$tname-im.opt"; - $tinfo->{'master_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : []; - $tinfo->{'slave_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : []; + $tinfo->{'master_opt'}= []; + $tinfo->{'slave_opt'}= []; $tinfo->{'slave_mi'}= []; if ( -f $master_opt_file ) @@ -306,7 +306,6 @@ sub collect_one_test_case($$$$$$$) { if ( defined $value ) { $tinfo->{'timezone'}= $value; - $tinfo->{'skip'}= 1 if $::glob_win32; # FIXME server unsets TZ last MASTER_OPT; } diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 4d88c9b3322..86a4312e0c8 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -781,7 +781,15 @@ sub mtr_record_dead_children () { } sub start_reap_all { - $SIG{CHLD}= 'IGNORE'; # FIXME is this enough? + # This causes terminating processes to not become zombies, avoiding + # the need for (or possibility of) explicit waitpid(). + $SIG{CHLD}= 'IGNORE'; + + # On some platforms (Linux, QNX, OSX, ...) there is potential race + # here. If a process terminated before setting $SIG{CHLD} (but after + # any attempt to waitpid() it), it will still be a zombie. So we + # have to handle any such process here. + while(waitpid(-1, &WNOHANG) > 0) { }; } sub stop_reap_all { diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index 515988ee5c7..88ddbf63d0f 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -185,39 +185,57 @@ sub mtr_report_stats ($) { } # ---------------------------------------------------------------------- + # If a debug run, there might be interesting information inside + # the "var/log/*.err" files. We save this info in "var/log/warnings" # ---------------------------------------------------------------------- if ( ! $::glob_use_running_server ) { + # Save and report if there was any fatal warnings/errors in err logs - # Report if there was any fatal warnings/errors in the log files - # - unlink("$::opt_vardir/log/warnings"); - unlink("$::opt_vardir/log/warnings.tmp"); - # Remove some non fatal warnings from the log files - -# FIXME what is going on ????? ;-) -# sed -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' \ -# var/log/*.err \ -# | sed -e 's!Warning: Table:.* on rename!!g' \ -# > var/log/warnings.tmp; -# -# found_error=0; -# # Find errors -# for i in "^Warning:" "^Error:" "^==.* at 0x" -# do -# if ( $GREP "$i" var/log/warnings.tmp >> var/log/warnings ) -# { -# found_error=1 -# } -# done -# unlink("$::opt_vardir/log/warnings.tmp"); -# if ( $found_error= "1" ) -# { -# print "WARNING: Got errors/warnings while running tests. Please examine\n" -# print "$::opt_vardir/log/warnings for details.\n" -# } -# } + my $warnlog= "$::opt_vardir/log/warnings"; + + unless ( open(WARN, ">$warnlog") ) + { + mtr_warning("can't write to the file \"$warnlog\": $!"); + } + else + { + my $found_problems= 0; # Some warnings are errors... + + # We report different types of problems in order + foreach my $pattern ( "^Warning:", "^Error:", "^==.* at 0x" ) + { + foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") ) + { + unless ( open(ERR, $errlog) ) + { + mtr_warning("can't read $errlog"); + next; + } + while ( <ERR> ) + { + # Skip some non fatal warnings from the log files + if ( /Warning:\s+Table:.* on (delete|rename)/ or + /Warning:\s+Setting lower_case_table_names=2/ or + /Warning:\s+One can only use the --user.*root/ ) + { + next; # Skip these lines + } + if ( /$pattern/ ) + { + $found_problems= 1; + print WARN $_; + } + } + } + if ( $found_problems ) + { + mtr_warning("Got errors/warnings while running tests, please examine", + "\"$warnlog\" for details."); + } + } + } } print "\n"; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ae277c4a554..c708b0e92ce 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -155,6 +155,7 @@ our $path_client_bindir; our $path_language; our $path_timefile; our $path_manager_log; # Used by mysqldadmin +our $path_slave_load_tmpdir; # What is this?! our $path_mysqltest_log; our $path_my_basedir; our $opt_vardir; # A path but set directly on cmd line @@ -470,6 +471,9 @@ sub initial_setup () { $glob_basedir= dirname($glob_mysql_test_dir); $glob_mysql_bench_dir= "$glob_basedir/mysql-bench"; # FIXME make configurable + # needs to be same length to test logging (FIXME what???) + $path_slave_load_tmpdir= "../../var/tmp"; + $path_my_basedir= $opt_source_dist ? $glob_mysql_test_dir : $glob_basedir; @@ -496,14 +500,25 @@ sub command_line_setup () { my $im_mysqld1_port= 9312; my $im_mysqld2_port= 9314; + # + # To make it easier for different devs to work on the same host, + # an environment variable can be used to control all ports. A small + # number is to be used, 0 - 16 or similar. + # + # Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x + # versions of this script, else a 4.0 test run might conflict with a + # 5.1 test run, even if different MTR_BUILD_THREAD is used. This means + # all port numbers might not be used in this version of the script. + # if ( $ENV{'MTR_BUILD_THREAD'} ) { - $opt_master_myport= $ENV{'MTR_BUILD_THREAD'} * 40 + 8120; - $opt_slave_myport= $opt_master_myport + 16; - $opt_ndbcluster_port= $opt_master_myport + 24; - $im_port= $opt_master_myport + 10; - $im_mysqld1_port= $opt_master_myport + 12; - $im_mysqld2_port= $opt_master_myport + 14; + # Up to two masters, up to three slaves + $opt_master_myport= $ENV{'MTR_BUILD_THREAD'} * 10 + 10000; # and 1 + $opt_slave_myport= $opt_master_myport + 2; # and 3 4 + $opt_ndbcluster_port= $opt_master_myport + 5; + $im_port= $opt_master_myport + 6; + $im_mysqld1_port= $opt_master_myport + 7; + $im_mysqld2_port= $opt_master_myport + 8; } # Read the command line @@ -655,6 +670,7 @@ sub command_line_setup () { # -------------------------------------------------------------------------- $opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir; + $opt_tmpdir =~ s,/+$,,; # Remove ending slash if any # FIXME maybe not needed? $path_manager_log= "$opt_vardir/log/manager.log" unless $path_manager_log; @@ -1099,16 +1115,21 @@ sub environment_setup () { $ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir; $ENV{'MYSQL_TEST_WINDIR'}= $glob_mysql_test_dir; $ENV{'MYSQLTEST_VARDIR'}= $opt_vardir; - $ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'}; $ENV{'MASTER_WINMYSOCK'}= $master->[0]->{'path_mysock'}; + $ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'}; $ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_mysock'}; $ENV{'MASTER_MYPORT'}= $master->[0]->{'path_myport'}; $ENV{'MASTER_MYPORT1'}= $master->[1]->{'path_myport'}; $ENV{'SLAVE_MYPORT'}= $slave->[0]->{'path_myport'}; + $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'path_myport'}; + $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'path_myport'}; # $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME $ENV{'MYSQL_TCP_PORT'}= 3306; + $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port; + $ENV{'IM_PATH_PID'}= $instance_manager->{path_pid}; + $ENV{'IM_PORT'}= $instance_manager->{port}; $ENV{'IM_MYSQLD1_SOCK'}= $instance_manager->{instances}->[0]->{path_sock}; $ENV{'IM_MYSQLD1_PORT'}= $instance_manager->{instances}->[0]->{port}; @@ -1127,14 +1148,19 @@ sub environment_setup () { } } + $ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set + # We are nice and report a bit about our settings - print "Using MTR_BUILD_THREAD = ",$ENV{MTR_BUILD_THREAD} || 0,"\n"; + print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n"; print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n"; print "Using MASTER_MYPORT1 = $ENV{MASTER_MYPORT1}\n"; print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n"; - print "Using NDBCLUSTER_PORT = $opt_ndbcluster_port\n"; - print "Using IM_MYSQLD1_PORT = $ENV{'IM_MYSQLD1_PORT'}\n"; - print "Using IM_MYSQLD2_PORT = $ENV{'IM_MYSQLD2_PORT'}\n"; + print "Using SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n"; + print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n"; + print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n"; + print "Using IM_PORT = $ENV{IM_PORT}\n"; + print "Using IM_MYSQLD1_PORT = $ENV{IM_MYSQLD1_PORT}\n"; + print "Using IM_MYSQLD2_PORT = $ENV{IM_MYSQLD2_PORT}\n"; } diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index ac5457beaa6..c4038f88da4 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -244,11 +244,16 @@ MYSQL_MANAGER_USER=root # an environment variable can be used to control all ports. A small # number is to be used, 0 - 16 or similar. # +# Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x +# versions of this script, else a 4.0 test run might conflict with a +# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means +# all port numbers might not be used in this version of the script. +# if [ -n "$MTR_BUILD_THREAD" ] ; then - MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 5 + 10000` + MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 10 + 10000` MYSQL_MANAGER_PORT=`expr $MASTER_MYPORT + 2` SLAVE_MYPORT=`expr $MASTER_MYPORT + 3` - NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 4` + NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 6` echo "Using MTR_BUILD_THREAD = $MTR_BUILD_THREAD" echo "Using MASTER_MYPORT = $MASTER_MYPORT" diff --git a/mysql-test/r/im_life_cycle.result b/mysql-test/r/im_life_cycle.result index f8eaf0ccb46..5df874ba452 100644 --- a/mysql-test/r/im_life_cycle.result +++ b/mysql-test/r/im_life_cycle.result @@ -62,3 +62,5 @@ SHOW INSTANCES; instance_name status mysqld1 online mysqld2 offline +SHOW INSTANCE STATUS; +ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result index 9dd75f1390c..09c4f9b29f9 100644 --- a/mysql-test/r/ndb_basic.result +++ b/mysql-test/r/ndb_basic.result @@ -671,6 +671,61 @@ CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb; select * from t1; b drop table t1; +create table t1 (a int) engine=ndb; +create table t2 (a int) engine=ndb; +insert into t1 values (1); +insert into t2 values (1); +delete t1.* from t1, t2 where t1.a = t2.a; +select * from t1; +a +select * from t2; +a +1 +drop table t1; +drop table t2; +CREATE TABLE t1 ( +i INT, +j INT, +x INT, +y INT, +z INT +) engine=ndb; +CREATE TABLE t2 ( +i INT, +k INT, +x INT, +y INT, +z INT +) engine=ndb; +CREATE TABLE t3 ( +j INT, +k INT, +x INT, +y INT, +z INT +) engine=ndb; +INSERT INTO t1 VALUES ( 1, 2,13,14,15); +INSERT INTO t2 VALUES ( 1, 3,23,24,25); +INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36); +UPDATE t1 AS a +INNER JOIN t2 AS b +ON a.i = b.i +INNER JOIN t3 AS c +ON a.j = c.j AND b.k = c.k +SET a.x = b.x, +a.y = b.y, +a.z = ( +SELECT sum(z) +FROM t3 +WHERE y = 34 +) +WHERE b.x = 23; +select * from t1; +i j x y z +1 2 23 24 71 +drop table t1; +drop table t2; +drop table t3; create table atablewithareallylongandirritatingname (a int); insert into atablewithareallylongandirritatingname values (2); select * from atablewithareallylongandirritatingname; diff --git a/mysql-test/t/im_life_cycle.imtest b/mysql-test/t/im_life_cycle.imtest index c2b1c9a56ec..20b4b0be17c 100644 --- a/mysql-test/t/im_life_cycle.imtest +++ b/mysql-test/t/im_life_cycle.imtest @@ -140,3 +140,12 @@ SHOW INSTANCES; --exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed SHOW INSTANCES; + +########################################################################### +# +# 1.1.8. Check that Instance Manager returns an error on +# incomplete SHOW INSTANCE STATUS command. +# +########################################################################### +--error 1149 +SHOW INSTANCE STATUS; diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test index 12aca73d82b..5d79d5eb9f9 100644 --- a/mysql-test/t/ndb_basic.test +++ b/mysql-test/t/ndb_basic.test @@ -614,6 +614,72 @@ CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb; select * from t1; drop table t1; +# +# Bug #17249 delete statement with join where clause fails +# when table do not have pk +# + +create table t1 (a int) engine=ndb; +create table t2 (a int) engine=ndb; +insert into t1 values (1); +insert into t2 values (1); +delete t1.* from t1, t2 where t1.a = t2.a; +select * from t1; +select * from t2; +drop table t1; +drop table t2; + +# +# Bug #17257 update fails for inner joins if tables +# do not have Primary Key +# + +CREATE TABLE t1 ( + i INT, + j INT, + x INT, + y INT, + z INT +) engine=ndb; + +CREATE TABLE t2 ( + i INT, + k INT, + x INT, + y INT, + z INT +) engine=ndb; + +CREATE TABLE t3 ( + j INT, + k INT, + x INT, + y INT, + z INT +) engine=ndb; + +INSERT INTO t1 VALUES ( 1, 2,13,14,15); +INSERT INTO t2 VALUES ( 1, 3,23,24,25); +INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36); + +UPDATE t1 AS a +INNER JOIN t2 AS b + ON a.i = b.i +INNER JOIN t3 AS c + ON a.j = c.j AND b.k = c.k +SET a.x = b.x, + a.y = b.y, + a.z = ( + SELECT sum(z) + FROM t3 + WHERE y = 34 + ) +WHERE b.x = 23; +select * from t1; +drop table t1; +drop table t2; +drop table t3; + # End of 4.1 tests # |