summaryrefslogtreecommitdiff
path: root/mysql-test/include
diff options
context:
space:
mode:
authorSerge Kozlov <Serge.Kozlov@sun.com>2009-04-04 01:33:13 +0400
committerSerge Kozlov <Serge.Kozlov@sun.com>2009-04-04 01:33:13 +0400
commita81e21f8a433cf4b4bd7ea5f9f9a6ec57ee388d4 (patch)
treecf49fdc47d87eebbc5c2d289e10adc1c28d026f5 /mysql-test/include
parent54bf80b63345647492a7ec0007e016ae2fd52ad5 (diff)
downloadmariadb-git-a81e21f8a433cf4b4bd7ea5f9f9a6ec57ee388d4.tar.gz
Bug#37716.
1. Test case was rewritten completely. 2. Test covers 3 cases: a) do deadlock on slave, wait retries of transaction, unlock slave before lock timeout; b) do deadlock on slave and wait error 'lock timeout exceed' on slave; c) same as b) but if of max relay log size = 0; 3. Added comments inline. 4. Updated result file.
Diffstat (limited to 'mysql-test/include')
-rw-r--r--mysql-test/include/wait_for_status_var.inc68
1 files changed, 68 insertions, 0 deletions
diff --git a/mysql-test/include/wait_for_status_var.inc b/mysql-test/include/wait_for_status_var.inc
new file mode 100644
index 00000000000..4c168da7f1a
--- /dev/null
+++ b/mysql-test/include/wait_for_status_var.inc
@@ -0,0 +1,68 @@
+# ==== Purpose ====
+#
+# Waits until a variable from SHOW STATUS has returned a specified
+# value, or until a timeout is reached.
+#
+# ==== Usage ====
+#
+# let $status_var= Threads_connected;
+# let $status_var_value= 1;
+# --source include/wait_for_status_var.inc
+#
+# Parameters:
+#
+# $status_var, $status_var_value
+# This macro will wait until the variable of SHOW STATUS
+# named $status_var gets the value $status_var_value. See
+# the example above.
+#
+# $status_type= GLOBAL|SESSION
+# To specify the type (attribute) of status variable and
+# run either SHOW GLOBAL STATUS or SHOW SESSION STATUS.
+#
+# $status_var_comparsion
+# By default, this file waits until $status_var becomes equal to
+# $status_var_value. If you want to wait until $status_var
+# becomes *unequal* to $status_var_value, set this parameter to the
+# string '!=', like this:
+# let $status_var_comparsion= !=;
+#
+# $status_timeout
+# The default timeout is 1 minute. You can change the timeout by
+# setting $status_timeout. The unit is tenths of seconds.
+#
+
+if (`SELECT STRCMP('$status_type', '') * STRCMP(UPPER('$status_type'), 'SESSION') * STRCMP(UPPER('$status_type'), 'GLOBAL')`)
+{
+ --echo **** ERROR: Unknown type of variable status_type: allowed values are: SESSION or GLOBAL ****
+ exit;
+}
+
+let $_status_timeout_counter= $status_timeout;
+if (!$_status_timeout_counter)
+{
+ let $_status_timeout_counter= 600;
+}
+
+let $_status_var_comparsion= $status_var_comparsion;
+if (`SELECT '$_status_var_comparsion' = ''`)
+{
+ let $_status_var_comparsion= =;
+}
+
+let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE '$status_var'", Value, 1);
+while (`SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_value')`)
+{
+ if (!$_status_timeout_counter)
+ {
+ --echo **** ERROR: failed while waiting for $status_type $status_var $_status_var_comparison $status_var_value ****
+ --echo Note: the following output may have changed since the failure was detected
+ --echo **** Showing STATUS, PROCESSLIST ****
+ eval SHOW $status_type STATUS LIKE '$status_var';
+ SHOW PROCESSLIST;
+ exit;
+ }
+ dec $_status_timeout_counter;
+ sleep 0.1;
+ let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE '$status_var'", Value, 1);
+}