List:Commits« Previous MessageNext Message »
From:Martin Skold Date:June 12 2006 7:28am
Subject:bk commit into 4.1 tree (mskold:1.2492)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of marty. When marty does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2492 06/06/12 09:28:27 mskold@stripped +2 -0
  Added lock test on index scan

  mysql-test/t/ndb_lock.test
    1.9 06/06/12 09:28:13 mskold@stripped +39 -4
    Added lock test on index scan

  mysql-test/r/ndb_lock.result
    1.7 06/06/12 09:28:13 mskold@stripped +51 -24
    Added lock test on index scan

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	mskold
# Host:	linux.site
# Root:	/home/marty/MySQL/mysql-4.1

--- 1.6/mysql-test/r/ndb_lock.result	2006-06-08 16:12:07 +02:00
+++ 1.7/mysql-test/r/ndb_lock.result	2006-06-12 09:28:13 +02:00
@@ -63,61 +63,88 @@ pk	u	o
 5	5	5
 insert into t1 values (1,1,1);
 drop table t1;
-create table t1 (x integer not null primary key, y varchar(32)) engine = ndb;
-insert into t1 values (1,'one'), (2,'two'),(3,"three");
+create table t1 (x integer not null primary key, y varchar(32), z integer, key(z)) engine = ndb;
+insert into t1 values (1,'one',1), (2,'two',2),(3,"three",3);
 begin;
 select * from t1 where x = 1 for update;
-x	y
-1	one
+x	y	z
+1	one	1
 begin;
 select * from t1 where x = 2 for update;
-x	y
-2	two
+x	y	z
+2	two	2
 select * from t1 where x = 1 for update;
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 rollback;
 commit;
 begin;
 select * from t1 where y = 'one' or y = 'three' for update;
-x	y
-3	three
-1	one
+x	y	z
+3	three	3
+1	one	1
 begin;
 select * from t1 where x = 2 for update;
-x	y
-2	two
+x	y	z
+2	two	2
 select * from t1 where x = 1 for update;
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 rollback;
 commit;
 begin;
+select * from t1 where z > 1 and z < 3 for update;
+x	y	z
+2	two	2
+begin;
+select * from t1 where x = 1 for update;
+x	y	z
+1	one	1
+select * from t1 where x = 2 for update;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+rollback;
+commit;
+begin;
 select * from t1 where x = 1 lock in share mode;
-x	y
-1	one
+x	y	z
+1	one	1
 begin;
 select * from t1 where x = 1 lock in share mode;
-x	y
-1	one
+x	y	z
+1	one	1
 select * from t1 where x = 2 for update;
-x	y
-2	two
+x	y	z
+2	two	2
 select * from t1 where x = 1 for update;
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 rollback;
 commit;
 begin;
 select * from t1 where y = 'one' or y = 'three' lock in share mode;
-x	y
-3	three
-1	one
+x	y	z
+3	three	3
+1	one	1
 begin;
 select * from t1 where y = 'one' lock in share mode;
-x	y
-1	one
+x	y	z
+1	one	1
 select * from t1 where x = 2 for update;
-x	y
-2	two
+x	y	z
+2	two	2
 select * from t1 where x = 1 for update;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+rollback;
+commit;
+begin;
+select * from t1 where z > 1 and z < 3 lock in share mode;
+x	y	z
+2	two	2
+begin;
+select * from t1 where z = 1 lock in share mode;
+x	y	z
+1	one	1
+select * from t1 where x = 1 for update;
+x	y	z
+1	one	1
+select * from t1 where x = 2 for update;
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 rollback;
 commit;

--- 1.8/mysql-test/t/ndb_lock.test	2006-06-08 16:12:08 +02:00
+++ 1.9/mysql-test/t/ndb_lock.test	2006-06-12 09:28:13 +02:00
@@ -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;
@@ -138,6 +155,24 @@ select * from t1 where y = 'one' lock in
 select * from t1 where x = 2 for update;
 --error 1205
 select * from t1 where x = 1 for update;
+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;
Thread
bk commit into 4.1 tree (mskold:1.2492)Martin Skold12 Jun