diff options
author | unknown <monty@mysql.com> | 2004-10-20 16:04:28 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-10-20 16:04:28 +0300 |
commit | ec8779e95a46b3dfff492196ad004cb2716df3c3 (patch) | |
tree | 23e87e07794af4dd31668c4f6f75475638445d9c /mysql-test/t/innodb-lock.test | |
parent | 95f0e39a38435e0451e77c919ce21697eaccd334 (diff) | |
download | mariadb-git-ec8779e95a46b3dfff492196ad004cb2716df3c3.tar.gz |
Fix test case for innodb-lock
mysql-test/r/innodb-lock.result:
Fix test case (old one didn't test things correctly)
mysql-test/t/innodb-lock.test:
Fix test case (old one didn't test things correctly)
mysys/thr_lock.c:
More debugging information
sql/mysqld.cc:
Enable innodb_table_locks as default, as otherwise there is a possibility for deadlocks
sql/sql_base.cc:
More debug information
Diffstat (limited to 'mysql-test/t/innodb-lock.test')
-rw-r--r-- | mysql-test/t/innodb-lock.test | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/mysql-test/t/innodb-lock.test b/mysql-test/t/innodb-lock.test index 11395b301c4..430369f4fda 100644 --- a/mysql-test/t/innodb-lock.test +++ b/mysql-test/t/innodb-lock.test @@ -1,9 +1,5 @@ -- source include/have_innodb.inc -connect (con1,localhost,root,,); -connect (con2,localhost,root,,); -drop table if exists t1; - # # Check and select innodb lock type # @@ -14,6 +10,14 @@ select @@innodb_table_locks; # Testing of explicit table locks with enforced table locks # +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); +drop table if exists t1; + +# +# Testing of explicit table locks with enforced table locks +# + set @@innodb_table_locks=1; connection con1; @@ -48,37 +52,44 @@ commit; drop table t1; # -# Try with old lock method (where LOCK TABLE is ignored) +# Try with old lock method (where LOCK TABLE is ignored by InnoDB) # set @@innodb_table_locks=0; -create table t1 (id integer, x integer) engine=INNODB; -insert into t1 values(0, 0); -set autocommit=0; +create table t1 (id integer primary key, x integer) engine=INNODB; +insert into t1 values(0, 0),(1,1),(2,2); +commit; SELECT * from t1 where id = 0 FOR UPDATE; connection con2; set autocommit=0; +set @@innodb_table_locks=0; -# The following statement should hang because con1 is locking the page ---send +# The following statement should work becase innodb doesn't check table locks lock table t1 write; ---sleep 2; connection con1; -update t1 set x=1 where id = 0; -select * from t1; -commit; + +# This will be locked by MySQL +--send +update t1 set x=10 where id = 2; +--sleep 2 connection con2; -reap; -update t1 set x=2 where id = 0; + +# Note that we will get a deadlock if we try to select any rows marked +# for update by con1 ! + +SELECT * from t1 where id = 2; +UPDATE t1 set x=3 where id = 2; +commit; +SELECT * from t1; commit; unlock tables; connection con1; -select * from t1; +reap; commit; - +select * from t1; drop table t1; |