summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Prohaska <prohaska@tokutek.com>2013-10-03 16:53:46 -0400
committerRich Prohaska <prohaska@tokutek.com>2013-10-03 16:53:46 -0400
commitb09f1c49bf476f4e5414a098b0095933fb6d17ce (patch)
treea548ea3146925654d64810a43acb41f106b34eeb
parentcfc9021620af825828fe84f0362248b5f297fb80 (diff)
downloadmariadb-git-b09f1c49bf476f4e5414a098b0095933fb6d17ce.tar.gz
#90 test lock timeout
-rw-r--r--mysql-test/suite/tokudb/r/i_s_tokudb_lock_waits_timeout.result38
-rw-r--r--mysql-test/suite/tokudb/t/i_s_tokudb_lock_waits_timeout.test62
2 files changed, 100 insertions, 0 deletions
diff --git a/mysql-test/suite/tokudb/r/i_s_tokudb_lock_waits_timeout.result b/mysql-test/suite/tokudb/r/i_s_tokudb_lock_waits_timeout.result
new file mode 100644
index 00000000000..1e0668164ff
--- /dev/null
+++ b/mysql-test/suite/tokudb/r/i_s_tokudb_lock_waits_timeout.result
@@ -0,0 +1,38 @@
+set default_storage_engine='tokudb';
+set tokudb_prelock_empty=false;
+drop table if exists t;
+create table t (id int primary key);
+select * from information_schema.tokudb_trx;
+trx_id trx_mysql_thread_id
+select * from information_schema.tokudb_locks;
+locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right
+select * from information_schema.tokudb_lock_waits;
+requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time
+set autocommit=0;
+insert into t values (1);
+set autocommit=0;
+insert into t values (1);
+select * from information_schema.tokudb_locks;
+locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right
+TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000
+select * from information_schema.tokudb_lock_waits;
+requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time
+REQUEST_TRX_ID BLOCK_TRX_ID ./test/t-main 0001000000 0001000000 LOCK_WAITS_START_TIME
+select * from information_schema.tokudb_trx;
+trx_id trx_mysql_thread_id
+TRX_ID MYSQL_ID
+TRX_ID MYSQL_ID
+commit;
+select * from information_schema.tokudb_locks;
+locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right
+select * from information_schema.tokudb_lock_waits;
+requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+commit;
+select * from information_schema.tokudb_trx;
+trx_id trx_mysql_thread_id
+select * from information_schema.tokudb_locks;
+locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right
+select * from information_schema.tokudb_lock_waits;
+requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time
+drop table t;
diff --git a/mysql-test/suite/tokudb/t/i_s_tokudb_lock_waits_timeout.test b/mysql-test/suite/tokudb/t/i_s_tokudb_lock_waits_timeout.test
new file mode 100644
index 00000000000..faf0ffb72da
--- /dev/null
+++ b/mysql-test/suite/tokudb/t/i_s_tokudb_lock_waits_timeout.test
@@ -0,0 +1,62 @@
+# verify that tokudb_locks and tokudb_lock_waits contents for 2 conflicting transactions with a lock timeout
+
+source include/have_tokudb.inc;
+set default_storage_engine='tokudb';
+set tokudb_prelock_empty=false;
+disable_warnings;
+drop table if exists t;
+enable_warnings;
+
+create table t (id int primary key);
+
+# should be empty
+select * from information_schema.tokudb_trx;
+select * from information_schema.tokudb_locks;
+select * from information_schema.tokudb_lock_waits;
+
+connect (conn_a,localhost,root,,);
+set autocommit=0;
+insert into t values (1);
+
+connect (conn_b,localhost,root,,);
+set autocommit=0;
+send insert into t values (1);
+
+# should find the presence of a lock on 1st transaction
+connection default;
+replace_column 1 TRX_ID 2 MYSQL_ID;
+select * from information_schema.tokudb_locks;
+
+# should find the presence of a lock_wait on the 2nd transaction
+replace_column 1 REQUEST_TRX_ID 2 BLOCK_TRX_ID 6 LOCK_WAITS_START_TIME;
+select * from information_schema.tokudb_lock_waits;
+
+# should find the presence of two transactions
+replace_column 1 TRX_ID 2 MYSQL_ID;
+select * from information_schema.tokudb_trx;
+
+connection conn_a;
+sleep 5; # sleep longer than the lock timer to force a lock timeout on txn_b
+commit;
+
+# verify that the lock on the 1st transaction is released and replaced by the lock for the 2nd transaction
+replace_column 1 TRX_ID 2 MYSQL_ID;
+select * from information_schema.tokudb_locks;
+select * from information_schema.tokudb_lock_waits;
+
+connection conn_b;
+--error 1205 # lock timeout
+reap;
+commit;
+
+connection default;
+disconnect conn_a;
+disconnect conn_b;
+
+# should be be empty
+select * from information_schema.tokudb_trx;
+select * from information_schema.tokudb_locks;
+select * from information_schema.tokudb_lock_waits;
+
+# cleanup
+drop table t;