diff options
author | unknown <knielsen@knielsen-hq.org> | 2014-02-10 12:39:26 +0100 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2014-02-10 12:39:26 +0100 |
commit | fefdb576bb6b49adcff914f909429781452dd7bf (patch) | |
tree | 9a9e5f5f6e796e4e621eb593ed7992be57aa3683 /sql/sys_vars.cc | |
parent | 8cc6e90d74f4377491bcb7a0f1acd41ccf9fbcae (diff) | |
parent | 4a976545e518e70d5124e356a057c8d9624038a3 (diff) | |
download | mariadb-git-fefdb576bb6b49adcff914f909429781452dd7bf.tar.gz |
Merge of MDEV-4984, MDEV-4726, and MDEV-5636 into 10.0-base.
MDEV-4984: Implement MASTER_GTID_WAIT() and @@LAST_GTID.
MDEV-4726: Race in mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
MDEV-5636: Deadlock in RESET MASTER
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r-- | sql/sys_vars.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 7b0b64f9961..0495ee3e240 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1538,6 +1538,33 @@ static Sys_var_gtid_binlog_state Sys_gtid_binlog_state( GLOBAL_VAR(opt_gtid_binlog_state_dummy), NO_CMD_LINE); +static Sys_var_last_gtid Sys_last_gtid( + "last_gtid", "The GTID of the last commit (if binlogging was enabled), " + "or the empty string if none.", + READ_ONLY sys_var::ONLY_SESSION, NO_CMD_LINE); + + +uchar * +Sys_var_last_gtid::session_value_ptr(THD *thd, LEX_STRING *base) +{ + char buf[10+1+10+1+20+1]; + String str(buf, sizeof(buf), system_charset_info); + char *p; + bool first= true; + + str.length(0); + if ((thd->last_commit_gtid.seq_no > 0 && + rpl_slave_state_tostring_helper(&str, &thd->last_commit_gtid, &first)) || + !(p= thd->strmake(str.ptr(), str.length()))) + { + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return NULL; + } + + return (uchar *)p; +} + + static bool check_slave_parallel_threads(sys_var *self, THD *thd, set_var *var) { |