summaryrefslogtreecommitdiff
path: root/mysql-test/t/status.test
diff options
context:
space:
mode:
authorunknown <tsmith@ramayana.hindu.god>2007-08-17 19:29:08 -0600
committerunknown <tsmith@ramayana.hindu.god>2007-08-17 19:29:08 -0600
commit4f3c8e772329e242dd2b7c8885b1f99246b02849 (patch)
tree87d037d5b244a472df766151ad770620876b2bca /mysql-test/t/status.test
parent430df009a02a2e5daa1156b05a37db31a4f15c06 (diff)
downloadmariadb-git-4f3c8e772329e242dd2b7c8885b1f99246b02849.tar.gz
Bug #29307: status.test fails with different Table_locks_immediate
When using --log --log-output=table, we increment Table_locks_immediate with every query. The wait_condition.inc runs a query a variable number of times, depending on server load, etc. This is a problem, when the test is checking the Table_locks_immediate value. Fix is to adjust the Table_locks_immediate value based on how many times the wait_condition query was executed. mysql-test/include/wait_condition.inc: Add a $wait_condition_reps variable, which lets the caller check how many times the wait_condition query was executed. This is used in the main.status test to adjust the value of Table_locks_immediate (it gets incremented with each query when --log --log-output=table). mysql-test/t/status.test: Adjust Table_locks_immediate value based on how many times the wait_condition query had to run.
Diffstat (limited to 'mysql-test/t/status.test')
-rw-r--r--mysql-test/t/status.test30
1 files changed, 28 insertions, 2 deletions
diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test
index 9fd54d4766d..6320f5fb143 100644
--- a/mysql-test/t/status.test
+++ b/mysql-test/t/status.test
@@ -1,3 +1,6 @@
+# This test requires that --log-output includes 'table', and the general
+# log is on
+
# embedded server causes different stat
-- source include/not_embedded.inc
@@ -8,33 +11,56 @@ connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
flush status;
+
+# Logging to the general query log table (--log-output=table --log) increments
+# Table_locks_immediate with each query, so here Immediate becomes 1
show status like 'Table_lock%';
+# ++Immediate = 2
select * from information_schema.session_status where variable_name like 'Table_lock%';
+
connection con1;
+# ++Immediate = 3
SET SQL_LOG_BIN=0;
--disable_warnings
+# ++Immediate = 4
drop table if exists t1;
--enable_warnings
+# ++Immediate = 5
create table t1(n int) engine=myisam;
+# Immediate + 2 = 7
insert into t1 values(1);
+
connection con2;
+# Immediate + 2 = 9
lock tables t1 read;
+# ++Immediate = 10
unlock tables;
+# Immediate + 2 = 12
lock tables t1 read;
+
connection con1;
+# ++Immediate = 13
let $ID= `select connection_id()`;
+# ++Immediate = 14 (Not +2, because this increments Table_locks_waited)
--send
update t1 set n = 3;
+
connection con2;
# wait for the other query to start executing
let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST where ID = $ID and STATE = "Locked";
+# ++Immediate = 15 + $wait_condition_reps (wait_condition.inc does one select
+# in addition to the wait condition)
--source include/wait_condition.inc
+# ++Immediate = 16 + $wait_condition_reps
unlock tables;
+
connection con1;
reap;
-show status like 'Table_lock%';
-select * from information_schema.session_status where variable_name like 'Table_lock%';
+# ++Immediate = 17 + $wait_condition_reps
+show status like 'Table_locks_waited';
+# ++Immediate = 18 + $wait_condition_reps
+eval select variable_value - $wait_condition_reps as Immediate from information_schema.session_status where variable_name like 'Table_locks_immediate';
drop table t1;
disconnect con2;