summaryrefslogtreecommitdiff
path: root/sql/rpl_gtid.cc
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2015-03-16 13:41:11 +0100
committerKristian Nielsen <knielsen@knielsen-hq.org>2015-03-16 13:41:11 +0100
commit0e717c5bf424a7411030d625499485a821591830 (patch)
treeccff55a6c75ab59c42f5993eba4bbffaedbd7862 /sql/rpl_gtid.cc
parent18e9c314e43271debf58f3c3e5bf454eab655799 (diff)
parentfa5809ce109a8966059ea3cbda982cf2f160c430 (diff)
downloadmariadb-git-0e717c5bf424a7411030d625499485a821591830.tar.gz
Merge branch 'mdev-6981-master_gtid_wait-status-variables' of https://github.com/openquery/mariadb-server into danblack
Conflicts: sql/mysqld.cc
Diffstat (limited to 'sql/rpl_gtid.cc')
-rw-r--r--sql/rpl_gtid.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index 92dba552a57..078ec74b263 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -1995,10 +1995,14 @@ gtid_waiting::wait_for_pos(THD *thd, String *gtid_str, longlong timeout_us)
rpl_gtid *wait_pos;
uint32 count, i;
struct timespec wait_until, *wait_until_ptr;
+ ulonglong before;
/* Wait for the empty position returns immediately. */
if (gtid_str->length() == 0)
+ {
+ status_var_increment(thd->status_var.master_gtid_wait_count);
return 0;
+ }
if (!(wait_pos= gtid_parse_string_to_list(gtid_str->ptr(), gtid_str->length(),
&count)))
@@ -2006,6 +2010,8 @@ gtid_waiting::wait_for_pos(THD *thd, String *gtid_str, longlong timeout_us)
my_error(ER_INCORRECT_GTID_STATE, MYF(0));
return 1;
}
+ status_var_increment(thd->status_var.master_gtid_wait_count);
+ before = microsecond_interval_timer();
if (timeout_us >= 0)
{
@@ -2020,6 +2026,13 @@ gtid_waiting::wait_for_pos(THD *thd, String *gtid_str, longlong timeout_us)
if ((err= wait_for_gtid(thd, &wait_pos[i], wait_until_ptr)))
break;
}
+ switch (err)
+ {
+ case -1:
+ status_var_increment(thd->status_var.master_gtid_wait_timeouts);
+ case 0: /* deliberate fall through */
+ status_var_add(thd->status_var.master_gtid_wait_time, microsecond_interval_timer() - before);
+ }
my_free(wait_pos);
return err;
}