summaryrefslogtreecommitdiffstats
path: root/mysql-test/include/sync_with_master_gtid.inc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:24:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:24:36 +0000
commit06eaf7232e9a920468c0f8d74dcf2fe8b555501c (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/include/sync_with_master_gtid.inc
parentInitial commit. (diff)
downloadmariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.tar.xz
mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/include/sync_with_master_gtid.inc')
-rw-r--r--mysql-test/include/sync_with_master_gtid.inc52
1 files changed, 52 insertions, 0 deletions
diff --git a/mysql-test/include/sync_with_master_gtid.inc b/mysql-test/include/sync_with_master_gtid.inc
new file mode 100644
index 00000000..777711b9
--- /dev/null
+++ b/mysql-test/include/sync_with_master_gtid.inc
@@ -0,0 +1,52 @@
+# ==== Purpose ====
+#
+# Wait until the slave has reached a certain GTID position.
+# Similar to --sync_with_master, but using GTID instead of old-style
+# binlog file/offset coordinates.
+#
+#
+# ==== Usage ====
+#
+# --let $master_pos= `SELECT @@GLOBAL.gtid_binlog_pos`
+# [--let $slave_timeout= NUMBER]
+# [--let $rpl_debug= 1]
+# --source include/sync_with_master_gtid.inc
+#
+# Syncs slave to the specified GTID position.
+#
+# Must be called on the slave.
+#
+# Parameters:
+# $master_pos
+# The GTID position to sync to. Typically obtained from
+# @@GLOBAL.gtid_binlog_pos on the master.
+#
+# $slave_timeout
+# Timeout in seconds. The default is 2 minutes.
+#
+# $rpl_debug
+# See include/rpl_init.inc
+
+--let $include_filename= sync_with_master_gtid.inc
+--source include/begin_include_file.inc
+
+let $_slave_timeout= $slave_timeout;
+if (!$_slave_timeout)
+{
+ let $_slave_timeout= 120;
+ if ($VALGRIND_TEST)
+ {
+ let $_slave_timeout= 1200;
+ }
+}
+
+--let $_result= `SELECT master_gtid_wait('$master_pos', $_slave_timeout)`
+if ($_result == -1)
+{
+ --let $_current_gtid_pos= `SELECT @@GLOBAL.gtid_slave_pos`
+ --echo Timeout in master_gtid_wait('$master_pos', $_slave_timeout), current slave GTID position is: $_current_gtid_pos.
+ --die Failed to sync with master
+}
+
+--let $include_filename= sync_with_master_gtid.inc
+--source include/end_include_file.inc