diff options
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r-- | sql/sql_repl.cc | 26 |
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(>id_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 */ |