diff options
author | unknown <kroki@mysql.com> | 2006-04-24 18:06:43 +0400 |
---|---|---|
committer | unknown <kroki@mysql.com> | 2006-04-24 18:06:43 +0400 |
commit | 9fc25141a20bdbd0d467f7115309954959f985f7 (patch) | |
tree | 3dd2a796c862d974789a1b0013dc02450ecf4f15 /mysql-test/t/func_misc.test | |
parent | 73f5ae213d18d62ca9489577798a8a2beec9c9bc (diff) | |
download | mariadb-git-9fc25141a20bdbd0d467f7115309954959f985f7.tar.gz |
Bug#16501: IS_USED_LOCK does not appear to work
Update User_level_lock::thread_id on acquiring an existing lock,
and reset it on lock release.
mysql-test/r/func_misc.result:
Add result for bug#16501.
mysql-test/t/func_misc.test:
Add test case for bug#16501.
sql/item_func.cc:
Update User_level_lock::thread_id on acquiring an existing lock,
and reset it on lock release (for safety).
Diffstat (limited to 'mysql-test/t/func_misc.test')
-rw-r--r-- | mysql-test/t/func_misc.test | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index 87d9d601c87..9c706161ba9 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -43,4 +43,42 @@ create table t1 as select uuid(), length(uuid()); show create table t1; drop table t1; + +# +# Bug#16501: IS_USED_LOCK does not appear to work +# +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (conn CHAR(7), connection_id INT); +INSERT INTO t1 VALUES ('default', CONNECTION_ID()); + +SELECT GET_LOCK('bug16501',600); + +connect (con1,localhost,root,,); +INSERT INTO t1 VALUES ('con1', CONNECTION_ID()); +SELECT IS_USED_LOCK('bug16501') = connection_id +FROM t1 +WHERE conn = 'default'; +send SELECT GET_LOCK('bug16501',600); + +connection default; +SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID(); +SELECT RELEASE_LOCK('bug16501'); +SELECT IS_USED_LOCK('bug16501') = connection_id +FROM t1 +WHERE conn = 'con1'; + +connection con1; +reap; +SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID(); +SELECT RELEASE_LOCK('bug16501'); +SELECT IS_USED_LOCK('bug16501'); + +disconnect con1; +connection default; + +DROP TABLE t1; + # End of 4.1 tests |