From c70da572c4ffb3a8abaea1edb1157638e44924dd Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 26 Oct 2007 11:42:33 +0200 Subject: [PATCH] commit of WL#3686 test case already in 5.1 to get regression testing, no code committed mysql-test/suite/ndb/r/ndb_update_no_read.result: New BitKeeper file ``mysql-test/suite/ndb/r/ndb_update_no_read.result'' mysql-test/suite/ndb/t/ndb_update_no_read.test: New BitKeeper file ``mysql-test/suite/ndb/t/ndb_update_no_read.test'' --- .../suite/ndb/r/ndb_update_no_read.result | 75 ++++++++++++++++++ .../suite/ndb/t/ndb_update_no_read.test | 79 +++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 mysql-test/suite/ndb/r/ndb_update_no_read.result create mode 100644 mysql-test/suite/ndb/t/ndb_update_no_read.test diff --git a/mysql-test/suite/ndb/r/ndb_update_no_read.result b/mysql-test/suite/ndb/r/ndb_update_no_read.result new file mode 100644 index 00000000000..4373800d338 --- /dev/null +++ b/mysql-test/suite/ndb/r/ndb_update_no_read.result @@ -0,0 +1,75 @@ +DROP TABLE IF EXISTS t1; +create table t1 (a int not null primary key, b int not null, c int, +unique index_b (b) using hash) +engine ndb; +insert into t1 values (1,10,1),(2,9,1),(3,8,1),(4,7,1),(5,6,1),(6,5,2),(7,4,2),(8,3,2), +(9,2,2),(10,1,2); +update t1 set c = 111, b = 20 where a = 1; +select * from t1 where a = 1 order by a; +a b c +1 20 111 +delete from t1 where a = 1; +select * from t1 where a = 1 order by a; +a b c +update t1 set c = 12, b = 19 where b = 2; +select * from t1 where b = 2 order by a; +a b c +delete from t1 where b = 19; +select * from t1 where b = 19 order by a; +a b c +update t1 set c = 22 where a = 10 or a >= 10; +select * from t1 order by a; +a b c +2 9 1 +3 8 1 +4 7 1 +5 6 1 +6 5 2 +7 4 2 +8 3 2 +10 1 22 +update t1 set c = 23 where a in (8,10); +select * from t1 order by a; +a b c +2 9 1 +3 8 1 +4 7 1 +5 6 1 +6 5 2 +7 4 2 +8 3 23 +10 1 23 +update t1 set c = 23 where a in (7,8) or a >= 10; +select * from t1 order by a; +a b c +2 9 1 +3 8 1 +4 7 1 +5 6 1 +6 5 2 +7 4 23 +8 3 23 +10 1 23 +update t1 set c = 11 where a = 3 or b = 7; +select * from t1 where a = 3 or b = 7 order by a; +a b c +3 8 11 +4 7 11 +update t1 set a = 13, b = 20 where a = 3; +select * from t1 where a = 13 order by a; +a b c +13 20 11 +update t1 set a = 12, b = 19 where b = 7; +select * from t1 where b = 19 order by a; +a b c +12 19 11 +select * from t1 where b = 7 order by a; +a b c +update t1 set c = 12, b = 29 where a = 5 and b = 6; +select * from t1 where b = 19 order by a; +a b c +12 19 11 +delete from t1 where b = 6 and c = 12; +select * from t1 where b = 6 order by a; +a b c +drop table t1; diff --git a/mysql-test/suite/ndb/t/ndb_update_no_read.test b/mysql-test/suite/ndb/t/ndb_update_no_read.test new file mode 100644 index 00000000000..60bea53b7b5 --- /dev/null +++ b/mysql-test/suite/ndb/t/ndb_update_no_read.test @@ -0,0 +1,79 @@ +-- source include/have_ndb.inc +-- source include/not_embedded.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# +# New test case for WL 3686 (which is not until CGE-6.3) +# but test is committed in 5.1 to verify consistant results. +# +# When only constant expressions in update statements and +# only PK or UK in WHERE clause. No extra WHERE parts are +# allowed. WL #3687 takes of more advanced variants of +# avoiding the read before the update/delete + +create table t1 (a int not null primary key, b int not null, c int, + unique index_b (b) using hash) +engine ndb; + +insert into t1 values (1,10,1),(2,9,1),(3,8,1),(4,7,1),(5,6,1),(6,5,2),(7,4,2),(8,3,2), + (9,2,2),(10,1,2); + +# These ones should use optimisation + +update t1 set c = 111, b = 20 where a = 1; + +select * from t1 where a = 1 order by a; + +delete from t1 where a = 1; + +select * from t1 where a = 1 order by a; + +update t1 set c = 12, b = 19 where b = 2; + +select * from t1 where b = 2 order by a; + +delete from t1 where b = 19; + +select * from t1 where b = 19 order by a; + +update t1 set c = 22 where a = 10 or a >= 10; + +select * from t1 order by a; + +update t1 set c = 23 where a in (8,10); + +select * from t1 order by a; + +update t1 set c = 23 where a in (7,8) or a >= 10; + +select * from t1 order by a; + +# These ones should not use optimisation + +update t1 set c = 11 where a = 3 or b = 7; + +select * from t1 where a = 3 or b = 7 order by a; + +update t1 set a = 13, b = 20 where a = 3; + +select * from t1 where a = 13 order by a; + +update t1 set a = 12, b = 19 where b = 7; + +select * from t1 where b = 19 order by a; + +select * from t1 where b = 7 order by a; + +update t1 set c = 12, b = 29 where a = 5 and b = 6; + +select * from t1 where b = 19 order by a; + +delete from t1 where b = 6 and c = 12; + +select * from t1 where b = 6 order by a; + +drop table t1; +