diff options
author | unknown <mskold@mysql.com> | 2006-06-08 16:12:38 +0200 |
---|---|---|
committer | unknown <mskold@mysql.com> | 2006-06-08 16:12:38 +0200 |
commit | 20e54ae6c579167c38ae9183e465f19ef0e60169 (patch) | |
tree | 1691889ea4d2b9b2210bdc28239c30042ad3df27 /mysql-test/t/ndb_lock.test | |
parent | 22e3b0c66f695e18269e2fc221461611fa5132c3 (diff) | |
download | mariadb-git-20e54ae6c579167c38ae9183e465f19ef0e60169.tar.gz |
Fix for Bug #18184 SELECT ... FOR UPDATE does not work..: implemented ha_ndblcuster::unlock_row() and explicitly lock all rows that are not being unlocked
Diffstat (limited to 'mysql-test/t/ndb_lock.test')
-rw-r--r-- | mysql-test/t/ndb_lock.test | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/mysql-test/t/ndb_lock.test b/mysql-test/t/ndb_lock.test index 6945f91ee39..42721c7d3f5 100644 --- a/mysql-test/t/ndb_lock.test +++ b/mysql-test/t/ndb_lock.test @@ -69,4 +69,80 @@ insert into t1 values (1,1,1); drop table t1; +# Lock for update + +create table t1 (x integer not null primary key, y varchar(32)) engine = ndb; + +insert into t1 values (1,'one'), (2,'two'),(3,"three"); + +# PK access +connection con1; +begin; +select * from t1 where x = 1 for update; + +connection con2; +begin; +select * from t1 where x = 2 for update; +--error 1205 +select * from t1 where x = 1 for update; +rollback; + +connection con1; +commit; + +# scan +connection con1; +begin; +select * from t1 where y = 'one' or y = 'three' for update; + +connection con2; +begin; +# Have to check with pk access here since scans take locks on +# all rows and then release them in chunks +select * from t1 where x = 2 for update; +--error 1205 +select * from t1 where x = 1 for update; +rollback; + +connection con1; +commit; + +# share locking + +# PK access +connection con1; +begin; +select * from t1 where x = 1 lock in share mode; + +connection con2; +begin; +select * from t1 where x = 1 lock in share mode; +select * from t1 where x = 2 for update; +--error 1205 +select * from t1 where x = 1 for update; +rollback; + +connection con1; +commit; + +# scan +connection con1; +begin; +select * from t1 where y = 'one' or y = 'three' lock in share mode; + +connection con2; +begin; +select * from t1 where y = 'one' lock in share mode; +# Have to check with pk access here since scans take locks on +# all rows and then release them in chunks +select * from t1 where x = 2 for update; +--error 1205 +select * from t1 where x = 1 for update; +rollback; + +connection con1; +commit; + +drop table t1; + # End of 4.1 tests |