From f9a7a324140bf4229bbf7c1ff20ae95b7094cc77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 5 May 2010 13:40:01 +0300 Subject: [PATCH] Factor out innodb_multi_update.test from innodb.test --- mysql-test/suite/innodb/r/innodb.result | 80 +------------------ .../suite/innodb/r/innodb_multi_update.result | 76 ++++++++++++++++++ mysql-test/suite/innodb/t/disabled.def | 1 + mysql-test/suite/innodb/t/innodb.test | 27 ------- .../suite/innodb/t/innodb_multi_update.test | 29 +++++++ 5 files changed, 108 insertions(+), 105 deletions(-) create mode 100644 mysql-test/suite/innodb/r/innodb_multi_update.result create mode 100644 mysql-test/suite/innodb/t/innodb_multi_update.test diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index 5b84a64e8e8..c6f6f352743 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -1179,82 +1179,6 @@ a b 8 8 9 9 drop table t1; -CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb; -CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb; -INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); -INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); -update t1,t2 set t1.a=t1.a+100; -select * from t1; -a b -101 1 -102 2 -103 3 -104 4 -105 5 -106 6 -107 7 -108 8 -109 9 -110 10 -111 11 -112 12 -update t1,t2 set t1.a=t1.a+100 where t1.a=101; -select * from t1; -a b -201 1 -102 2 -103 3 -104 4 -105 5 -106 6 -107 7 -108 8 -109 9 -110 10 -111 11 -112 12 -update t1,t2 set t1.b=t1.b+10 where t1.b=2; -select * from t1; -a b -201 1 -103 3 -104 4 -105 5 -106 6 -107 7 -108 8 -109 9 -110 10 -111 11 -102 12 -112 12 -update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100; -select * from t1; -a b -201 1 -103 5 -104 6 -106 6 -105 7 -107 7 -108 8 -109 9 -110 10 -111 11 -102 12 -112 12 -select * from t2; -a b -1 1 -2 2 -6 6 -7 7 -8 8 -9 9 -3 13 -4 14 -5 15 -drop table t1,t2; CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM; CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=0; @@ -1747,10 +1671,10 @@ variable_value - @innodb_rows_deleted_orig 71 SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted'; variable_value - @innodb_rows_inserted_orig -1084 +1063 SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated'; variable_value - @innodb_rows_updated_orig -885 +865 SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits'; variable_value - @innodb_row_lock_waits_orig 0 diff --git a/mysql-test/suite/innodb/r/innodb_multi_update.result b/mysql-test/suite/innodb/r/innodb_multi_update.result new file mode 100644 index 00000000000..7af9b030d1f --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_multi_update.result @@ -0,0 +1,76 @@ +CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb; +CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb; +INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); +INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100; +select * from bug38999_1; +a b +101 1 +102 2 +103 3 +104 4 +105 5 +106 6 +107 7 +108 8 +109 9 +110 10 +111 11 +112 12 +update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101; +select * from bug38999_1; +a b +201 1 +102 2 +103 3 +104 4 +105 5 +106 6 +107 7 +108 8 +109 9 +110 10 +111 11 +112 12 +update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2; +select * from bug38999_1; +a b +201 1 +103 3 +104 4 +105 5 +106 6 +107 7 +108 8 +109 9 +110 10 +111 11 +102 12 +112 12 +update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100; +select * from bug38999_1; +a b +201 1 +103 5 +104 6 +106 6 +105 7 +107 7 +108 8 +109 9 +110 10 +111 11 +102 12 +112 12 +select * from bug38999_2; +a b +1 1 +2 2 +6 6 +7 7 +8 8 +9 9 +3 13 +4 14 +5 15 +drop table bug38999_1,bug38999_2; diff --git a/mysql-test/suite/innodb/t/disabled.def b/mysql-test/suite/innodb/t/disabled.def index 888298bbb09..da04138fd0a 100644 --- a/mysql-test/suite/innodb/t/disabled.def +++ b/mysql-test/suite/innodb/t/disabled.def @@ -9,3 +9,4 @@ # Do not use any TAB characters for whitespace. # ############################################################################## +innodb_multi_update: Bug #38999 2010-05-05 mmakela Valgrind warnings diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index 8641163e4f7..480183b9e2d 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -905,33 +905,6 @@ UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000; SELECT * from t1; drop table t1; -# -# Test multi update with different join methods -# - -CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb; -CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb; -INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); -INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); - -# Full join, without key -update t1,t2 set t1.a=t1.a+100; -select * from t1; - -# unique key -update t1,t2 set t1.a=t1.a+100 where t1.a=101; -select * from t1; - -# ref key -update t1,t2 set t1.b=t1.b+10 where t1.b=2; -select * from t1; - -# Range key (in t1) -update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100; -select * from t1; -select * from t2; - -drop table t1,t2; CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM; CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=0; diff --git a/mysql-test/suite/innodb/t/innodb_multi_update.test b/mysql-test/suite/innodb/t/innodb_multi_update.test new file mode 100644 index 00000000000..7ab17ccf70a --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_multi_update.test @@ -0,0 +1,29 @@ +-- source include/have_innodb.inc + +# +# Test multi update with different join methods +# + +CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb; +CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb; +INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); +INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); + +# Full join, without key +update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100; +select * from bug38999_1; + +# unique key +update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101; +select * from bug38999_1; + +# ref key +update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2; +select * from bug38999_1; + +# Range key (in bug38999_1) +update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100; +select * from bug38999_1; +select * from bug38999_2; + +drop table bug38999_1,bug38999_2;