diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/lock_multi.result | 12 | ||||
-rw-r--r-- | mysql-test/r/multi_update.result | 1 | ||||
-rw-r--r-- | mysql-test/t/lock_multi.test | 24 | ||||
-rw-r--r-- | mysql-test/t/multi_update.test | 2 |
4 files changed, 36 insertions, 3 deletions
diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result index b808fca0acf..b5672fe1791 100644 --- a/mysql-test/r/lock_multi.result +++ b/mysql-test/r/lock_multi.result @@ -17,6 +17,18 @@ unlock tables; n 1 drop table t1; +create table t1 (a int, b int); +create table t2 (c int, d int); +insert into t1 values(1,1); +insert into t1 values(2,2); +insert into t2 values(1,2); +lock table t1 read; + update t1,t2 set c=a where b=d; +select c from t2; +c +2 +drop table t1; +drop table t2; create table t1 (a int); create table t2 (a int); lock table t1 write, t2 write; diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 12cb965f045..fc414f2f46b 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -151,7 +151,6 @@ Table 't2' was locked with a READ lock and can't be updated UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; Table 't2' was locked with a READ lock and can't be updated UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; -Table 't2' was locked with a READ lock and can't be updated unlock tables; LOCK TABLES t1 write, t2 write; UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test index 0295fca29e7..e20f8163751 100644 --- a/mysql-test/t/lock_multi.test +++ b/mysql-test/t/lock_multi.test @@ -51,6 +51,30 @@ reap; drop table t1; # +# Test problem when using locks with multi-updates +# It should not block when multi-update is reading on a read-locked table +# + +connection locker; +create table t1 (a int, b int); +create table t2 (c int, d int); +insert into t1 values(1,1); +insert into t1 values(2,2); +insert into t2 values(1,2); +lock table t1 read; +connection writer; +--sleep 2 +send update t1,t2 set c=a where b=d; +connection reader; +--sleep 2 +select c from t2; +connection writer; +reap; +connection locker; +drop table t1; +drop table t2; + +# # Test problem when using locks on many tables and droping a table that # is to-be-locked by another thread # diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 39ea136bde1..3494126f890 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -151,8 +151,6 @@ LOCK TABLES t1 write, t2 read; DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n; --error 1099 UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; -# The following should be fixed to not give an error ---error 1099 UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; unlock tables; LOCK TABLES t1 write, t2 write; |