summaryrefslogtreecommitdiffstats
path: root/mysql-test/include/wait_for_binlog_event.inc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:07:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:07:14 +0000
commita175314c3e5827eb193872241446f2f8f5c9d33c (patch)
treecd3d60ca99ae00829c52a6ca79150a5b6e62528b /mysql-test/include/wait_for_binlog_event.inc
parentInitial commit. (diff)
downloadmariadb-10.5-upstream.tar.xz
mariadb-10.5-upstream.zip
Adding upstream version 1:10.5.12.upstream/1%10.5.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/include/wait_for_binlog_event.inc')
-rw-r--r--mysql-test/include/wait_for_binlog_event.inc33
1 files changed, 33 insertions, 0 deletions
diff --git a/mysql-test/include/wait_for_binlog_event.inc b/mysql-test/include/wait_for_binlog_event.inc
new file mode 100644
index 00000000..b251ae22
--- /dev/null
+++ b/mysql-test/include/wait_for_binlog_event.inc
@@ -0,0 +1,33 @@
+# include/wait_for_binlog_event.inc
+#
+# SUMMARY
+#
+# Waits until SHOW BINLOG EVENTS has returned in last event a specified substring.
+#
+# USAGE
+#
+# let $wait_binlog_event= DROP;
+# --source include/wait_for_binlog_event.inc
+
+let $_loop_count= 300;
+let $_last_event= ;
+let $_event_pos= 1;
+
+while (`SELECT INSTR("$_last_event","$wait_binlog_event") = 0`)
+{
+ dec $_loop_count;
+ if (!$_loop_count)
+ {
+ --source include/show_rpl_debug_info.inc
+ --die ERROR: failed while waiting for $wait_binlog_event in binlog
+ }
+ real_sleep 0.1;
+ let $_event= query_get_value(SHOW BINLOG EVENTS, Info, $_event_pos);
+ let $_last_event= $_event;
+ while ($_event != "No such row")
+ {
+ inc $_event_pos;
+ let $_last_event= $_event;
+ let $_event= query_get_value(SHOW BINLOG EVENTS, Info, $_event_pos);
+ }
+}