diff options
author | unknown <mskold@mysql.com> | 2006-06-12 09:28:27 +0200 |
---|---|---|
committer | unknown <mskold@mysql.com> | 2006-06-12 09:28:27 +0200 |
commit | a3f3696697f1ef991ea856fc9dd7bb113309555a (patch) | |
tree | 92ecb0ff80e660c864321a166a66dd9bc5bd86e8 /mysql-test/t/ndb_lock.test | |
parent | fc9da882276b996e4d258ee33fd70188eddbf0d4 (diff) | |
download | mariadb-git-a3f3696697f1ef991ea856fc9dd7bb113309555a.tar.gz |
Added lock test on index scan
Diffstat (limited to 'mysql-test/t/ndb_lock.test')
-rw-r--r-- | mysql-test/t/ndb_lock.test | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/mysql-test/t/ndb_lock.test b/mysql-test/t/ndb_lock.test index 42721c7d3f5..db42b7ec2dd 100644 --- a/mysql-test/t/ndb_lock.test +++ b/mysql-test/t/ndb_lock.test @@ -71,9 +71,9 @@ drop table t1; # Lock for update -create table t1 (x integer not null primary key, y varchar(32)) engine = ndb; +create table t1 (x integer not null primary key, y varchar(32), z integer, key(z)) engine = ndb; -insert into t1 values (1,'one'), (2,'two'),(3,"three"); +insert into t1 values (1,'one',1), (2,'two',2),(3,"three",3); # PK access connection con1; @@ -90,7 +90,7 @@ rollback; connection con1; commit; -# scan +# table scan connection con1; begin; select * from t1 where y = 'one' or y = 'three' for update; @@ -107,6 +107,23 @@ rollback; connection con1; commit; +# index scan +connection con1; +begin; +select * from t1 where z > 1 and z < 3 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 = 1 for update; +--error 1205 +select * from t1 where x = 2 for update; +rollback; + +connection con1; +commit; + # share locking # PK access @@ -125,7 +142,7 @@ rollback; connection con1; commit; -# scan +# table scan connection con1; begin; select * from t1 where y = 'one' or y = 'three' lock in share mode; @@ -143,6 +160,24 @@ rollback; connection con1; commit; +# index scan +connection con1; +begin; +select * from t1 where z > 1 and z < 3 lock in share mode; + +connection con2; +begin; +select * from t1 where z = 1 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 = 1 for update; +--error 1205 +select * from t1 where x = 2 for update; +rollback; + +connection con1; +commit; + drop table t1; # End of 4.1 tests |