summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2013-04-04 17:38:10 +0200
committerunknown <knielsen@knielsen-hq.org>2013-04-04 17:38:10 +0200
commitc2cbc9cee6a3f8f745501ee2f5fcfd4586f53bbd (patch)
treeb779d3a554d9f69556e1a805b46bf27261a5c451 /sql/sql_repl.cc
parentbdf6367d0e019703b48c62b1ae5728e48ba0eba7 (diff)
downloadmariadb-git-c2cbc9cee6a3f8f745501ee2f5fcfd4586f53bbd.tar.gz
MDEV-26: Global transaction ID.
Move combining slave and gtid binlog state into a separate function. Make SHOW ALL SLAVES STATUS use the same function, so it shows the same value used by slave connect. Add a test case.
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 0f8dbdd5112..ad5e5f64dad 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -3360,4 +3360,30 @@ rpl_deinit_gtid_slave_state()
rpl_global_gtid_slave_state.deinit();
}
+
+/*
+ Format the current GTID state as a string, for use when connecting to a
+ master server with GTID, or for returning the value of @@global.gtid_state.
+
+ If the flag use_binlog is true, then the contents of the binary log (if
+ enabled) is merged into the current GTID state.
+*/
+int
+rpl_append_gtid_state(String *dest, bool use_binlog)
+{
+ int err;
+ rpl_gtid *gtid_list= NULL;
+ uint32 num_gtids= 0;
+
+ if (opt_bin_log &&
+ (err= mysql_bin_log.get_most_recent_gtid_list(&gtid_list, &num_gtids)))
+ return err;
+
+ rpl_global_gtid_slave_state.tostring(dest, gtid_list, num_gtids);
+ my_free(gtid_list);
+
+ return 0;
+}
+
+
#endif /* HAVE_REPLICATION */