summaryrefslogtreecommitdiff
path: root/mysql-test/include
diff options
context:
space:
mode:
authorunknown <dlenev@mockturtle.local>2007-01-20 14:10:20 +0300
committerunknown <dlenev@mockturtle.local>2007-01-20 14:10:20 +0300
commita854d46cef2d6695aadb10e437300d8ef3f9cb84 (patch)
tree3af61fe7c1d7f9ed8ecb82fdf2521316c54e0e72 /mysql-test/include
parent6c6a2785e9538363bba4d0eec1b1ad1c86c02cd0 (diff)
parentac5e6f60a80e248227207d6c375ecf6b213e3046 (diff)
downloadmariadb-git-a854d46cef2d6695aadb10e437300d8ef3f9cb84.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into mockturtle.local:/home/dlenev/src/mysql-5.0-bg25044 sql/sql_table.cc: Auto merged
Diffstat (limited to 'mysql-test/include')
-rw-r--r--mysql-test/include/wait_show_pattern.inc51
-rw-r--r--mysql-test/include/wait_slave_status.inc43
2 files changed, 58 insertions, 36 deletions
diff --git a/mysql-test/include/wait_show_pattern.inc b/mysql-test/include/wait_show_pattern.inc
new file mode 100644
index 00000000000..c9f84ce7f08
--- /dev/null
+++ b/mysql-test/include/wait_show_pattern.inc
@@ -0,0 +1,51 @@
+# include/wait_show_pattern.inc
+#
+# SUMMARY
+#
+# Waits until output produced by SHOW statement which particular type is
+# specified as parameter matches certain pattern or maximum time reached.
+#
+# NOTES
+#
+# Only the first row produced by the parameter statement is checked.
+#
+# USAGE
+#
+# let $show_type= <Tail of SHOW statement>;
+# let $show_pattern= 'Pattern to be used for LIKE matching';
+# --source wait_show_pattern.inc
+#
+# EXAMPLES
+#
+# alter_table-big.test, wait_slave_status.inc
+#
+# SEE ALSO
+#
+# wait_slave_status.inc, wait_condition.inc (>=5.1)
+#
+###############################################################################
+
+--disable_query_log
+
+# We accept to wait maximum 30 seconds (0.2 sec/loop).
+let $wait_counter= 150;
+while ($wait_counter)
+{
+ let $result= `SHOW $show_type`;
+ let $success= `SELECT '$result' LIKE $show_pattern`;
+ if ($success)
+ {
+ let $wait_counter= 0;
+ }
+ if (!$success)
+ {
+ real_sleep 0.2;
+ dec $wait_counter;
+ }
+}
+if (!$success)
+{
+ echo Timeout in wait_show_pattern.inc \$show_type= $show_type \$show_pattern= $show_pattern (\$result= '$result');
+}
+
+--enable_query_log
diff --git a/mysql-test/include/wait_slave_status.inc b/mysql-test/include/wait_slave_status.inc
index 7d3636e673c..d8d048527cf 100644
--- a/mysql-test/include/wait_slave_status.inc
+++ b/mysql-test/include/wait_slave_status.inc
@@ -104,50 +104,21 @@
eval SELECT "let \$result_pattern= $result_pattern ;" AS "";
SELECT '--source include/wait_slave_status.inc' AS "";
-# We accept to wait maximum 30 seconds (0.2 sec/loop).
-let $max_wait= 150;
-while ($max_wait)
-{
- let $my_val= `SHOW SLAVE STATUS`;
- # Now we have the first record of the SHOW result set as one fat string
- # within the variable $my_val.
-
- eval SET @my_val = '$my_val';
- # DEBUG eval SELECT @my_val AS "response to SHOW SLAVE STATUS";
+let $show_type= SLAVE STATUS;
+let $show_pattern= $result_pattern;
+--enable_query_log
- eval SELECT @my_val LIKE $result_pattern INTO @success;
- # @success is '1' if we have a match
- # '0' if we have no match
- # DEBUG SELECT @success;
+--source include/wait_show_pattern.inc
- let $success= `SELECT @success`;
- let $no_success= `SELECT @success = 0`;
- if ($success)
- {
- # We reached the expected result and want to jump out of the loop
- # without unneeded sleeps.
- # Attention: Do not set $max_wait to 0, because "while" with negative value
- # does not work.
- let $max_wait= 1;
- }
- if ($no_success)
- {
- # We did not reach the expected result and will have to sleep again
- # or jump out of the loop, when max_wait is exhausted.
- real_sleep 0.2;
- }
- dec $max_wait;
-}
---enable_query_log
-if ($no_success)
+if (!$success)
{
let $message= ! Attention: Timeout in wait_slave_status.inc.
| Possible reasons with decreasing probability:
- | - The LIKE pattern ($result_pattern) is wrong, because the
+ | - The LIKE pattern is wrong, because the
| testcase was altered or the layout of the
| SHOW SLAVE STATUS result set changed.
| - There is a new bug within the replication.
- | - We met an extreme testing environment and $max_wait is
+ | - We met an extreme testing environment and timeout is
| too small.;
--source include/show_msg80.inc
--echo DEBUG INFO START (wait_slave_status.inc):