#At file:///work/bzr/mysql-5.1-39484/
2754 Horst Hunger 2009-02-13
Fix for bug#39484: I increased the get_lock timeout to 300 seconds as 10 second are too short for machines with low performance and a release_lock may end up with NULL due to a failed get_lock. I also replaced the sleeps by wait condition.
modified:
mysql-test/include/concurrent.inc
mysql-test/r/concurrent_innodb_safelog.result
=== modified file 'mysql-test/include/concurrent.inc'
--- a/mysql-test/include/concurrent.inc 2009-01-31 18:09:41 +0000
+++ b/mysql-test/include/concurrent.inc 2009-02-13 21:31:41 +0000
@@ -11,6 +11,8 @@
# $engine_type storage engine to be tested
#
# Last update:
+# 2009-02-13 HH Increased the get_lock timeout to 300 sec.,
+# replaced the sleeps by wait_condition.
# 2006-08-02 ML test refactored
# old name was t/innodb_concurrent.test
# main code went into include/concurrent.inc
@@ -79,7 +81,7 @@ drop table if exists t1;
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
--echo ** Get user level lock (ULL) for thread 1
- select get_lock("hello",10);
+ select get_lock("hello",300);
--echo ** connection thread2
connect (thread2, localhost, mysqltest,,);
@@ -88,11 +90,12 @@ drop table if exists t1;
begin;
--echo ** Update will cause a table scan and a new ULL will
--echo ** be created and blocked on the first row where tipo=11.
- send update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
- sleep 1;
+ send update t1 set eta=1+get_lock("hello",300)*0 where tipo=11;
--echo ** connection thread1
connection thread1;
+ let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
+ --source include/wait_condition.inc
--echo ** Start new transaction for thread 1
begin;
--echo ** Update on t1 will cause a table scan which will be blocked because
@@ -172,7 +175,7 @@ drop table t1;
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
--echo ** Get ULL "hello" on thread 1
- select get_lock("hello",10);
+ select get_lock("hello",300);
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
@@ -182,11 +185,12 @@ drop table t1;
--echo ** Update will cause a table scan.
--echo ** This will cause a hang on the first row where tipo=1 until the
--echo ** blocking ULL is released.
- send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
- sleep 1;
+ send update t1 set eta=1+get_lock("hello",300)*0 where tipo=1;
- --echo ** connection thread1
+--echo ** connection thread1
connection thread1;
+ let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
+ --source include/wait_condition.inc
--echo ** Start transaction on thread 1
begin;
--echo ** Update on t1 will cause a table scan which will be blocked because
@@ -254,7 +258,7 @@ drop table t1;
create table t1 (a int not null, b int not null);
insert into t1 values (1,1),(2,1),(3,1),(4,1);
--echo ** Create ULL 'hello2'
- select get_lock("hello2",10);
+ select get_lock("hello2",300);
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
@@ -263,11 +267,12 @@ drop table t1;
begin;
--echo ** Update will create a table scan which creates a ULL where a=2;
--echo ** this will hang waiting on thread 1.
- send update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
- sleep 1;
+ send update t1 set b=10+get_lock(concat("hello",a),300)*0 where a=2;
--echo ** connection thread1
connection thread1;
+ let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
+ --source include/wait_condition.inc
--echo ** Insert new values to t1 from thread 1; this created an implicit
--echo ** commit since there are no on-going transactions.
insert into t1 values (1,1);
@@ -534,10 +539,11 @@ drop table t1;
connection thread2;
begin;
send delete from t1 where tipo=2;
- sleep 1;
--echo ** connection thread1
connection thread1;
+ let $wait_condition= select count(*)= 0 from information_schema.processlist where info like 'delete from t1 where tipo=2';
+ --source include/wait_condition.inc
begin;
--error ER_LOCK_WAIT_TIMEOUT
update t1 set tipo=1 where tipo=2;
@@ -594,10 +600,11 @@ drop table t1;
connection thread2;
begin;
send delete from t1 where tipo=2;
- sleep 1;
--echo ** connection thread1
connection thread1;
+ let $wait_condition= select count(*)= 0 from information_schema.processlist where info like 'delete from t1 where tipo=2';
+ --source include/wait_condition.inc
begin;
--echo ** Update on t1 will cause a table scan which will be blocked because
--echo ** the previously initiated table scan applied exclusive key locks on
=== modified file 'mysql-test/r/concurrent_innodb_safelog.result'
--- a/mysql-test/r/concurrent_innodb_safelog.result 2009-01-31 18:09:41 +0000
+++ b/mysql-test/r/concurrent_innodb_safelog.result 2009-02-13 21:31:41 +0000
@@ -30,15 +30,15 @@ insert into t1 values (70,1,"iiiiiiiiiii
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** Get user level lock (ULL) for thread 1
-select get_lock("hello",10);
-get_lock("hello",10)
+select get_lock("hello",300);
+get_lock("hello",300)
1
** connection thread2
** Start transaction for thread 2
begin;
** Update will cause a table scan and a new ULL will
** be created and blocked on the first row where tipo=11.
-update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
+update t1 set eta=1+get_lock("hello",300)*0 where tipo=11;
** connection thread1
** Start new transaction for thread 1
begin;
@@ -173,8 +173,8 @@ insert into t1 values (70,1,"iiiiiiiiiii
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** Get ULL "hello" on thread 1
-select get_lock("hello",10);
-get_lock("hello",10)
+select get_lock("hello",300);
+get_lock("hello",300)
1
** connection thread2
** Start transaction on thread 2
@@ -182,7 +182,7 @@ begin;
** Update will cause a table scan.
** This will cause a hang on the first row where tipo=1 until the
** blocking ULL is released.
-update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
+update t1 set eta=1+get_lock("hello",300)*0 where tipo=1;
** connection thread1
** Start transaction on thread 1
begin;
@@ -305,15 +305,15 @@ SET SESSION STORAGE_ENGINE = InnoDB;
create table t1 (a int not null, b int not null);
insert into t1 values (1,1),(2,1),(3,1),(4,1);
** Create ULL 'hello2'
-select get_lock("hello2",10);
-get_lock("hello2",10)
+select get_lock("hello2",300);
+get_lock("hello2",300)
1
** connection thread2
** Begin a new transaction on thread 2
begin;
** Update will create a table scan which creates a ULL where a=2;
** this will hang waiting on thread 1.
-update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
+update t1 set b=10+get_lock(concat("hello",a),300)*0 where a=2;
** connection thread1
** Insert new values to t1 from thread 1; this created an implicit
** commit since there are no on-going transactions.
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (horst:2754) Bug#39484 | Horst Hunger | 13 Feb |