summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/lib/mtr_process.pl10
-rwxr-xr-xmysql-test/mysql-test-run.pl26
-rw-r--r--mysql-test/mysql-test-run.sh9
-rw-r--r--mysql-test/r/ndb_basic.result55
-rw-r--r--mysql-test/t/ndb_basic.test66
5 files changed, 158 insertions, 8 deletions
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 177665cf578..4da608ad345 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -770,7 +770,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/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 58308f0ccdd..addacab8f9a 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -463,11 +463,21 @@ sub command_line_setup () {
my $opt_slave_myport= 9308;
$opt_ndbcluster_port= 9350;
+ #
+ # 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;
+ $opt_master_myport= $ENV{'MTR_BUILD_THREAD'} * 10 + 10000;
+ $opt_slave_myport= $opt_master_myport + 2; # and 3 4
+ $opt_ndbcluster_port= $opt_master_myport + 5;
}
# Read the command line
@@ -975,12 +985,14 @@ sub environment_setup () {
$ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server;
$ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
$ENV{'MYSQL_TEST_WINDIR'}= $glob_mysql_test_dir;
- $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;
@@ -994,11 +1006,15 @@ 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 SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n";
+ print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n";
print "Using NDBCLUSTER_PORT = $opt_ndbcluster_port\n";
}
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 3f303911d11..9fcdacb22cb 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -215,11 +215,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/ndb_basic.result b/mysql-test/r/ndb_basic.result
index 42b5a39d3d8..68c8bc01a14 100644
--- a/mysql-test/r/ndb_basic.result
+++ b/mysql-test/r/ndb_basic.result
@@ -671,3 +671,58 @@ 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;
diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test
index c8cf5823500..fdc87382308 100644
--- a/mysql-test/t/ndb_basic.test
+++ b/mysql-test/t/ndb_basic.test
@@ -614,4 +614,70 @@ 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