diff options
author | Daniel Black <grooverdan@users.sourceforge.net> | 2015-03-12 06:43:38 +1100 |
---|---|---|
committer | Daniel Black <grooverdan@users.sourceforge.net> | 2015-03-12 06:43:38 +1100 |
commit | fa5809ce109a8966059ea3cbda982cf2f160c430 (patch) | |
tree | af3a7111ec807e2d43cc5627ac336e5be6ac4083 /sql/rpl_gtid.cc | |
parent | d61573d3e5c8f9d85b88f9fa2e79160b159bf67d (diff) | |
download | mariadb-git-fa5809ce109a8966059ea3cbda982cf2f160c430.tar.gz |
Add Master_gtid_wait_{count,time,timeouts} status
MASTER_GTID_WAIT function needs some status to evaluate its use.
master_gtid_wait_count indicates how many times the function is called.
master_gtid_wait_time indicates how much time in microseconds occurred
waiting (or timing out)
master_gtid_timeouts indicates how many time times this function timed
out rather than all successful gtids events being available.
Diffstat (limited to 'sql/rpl_gtid.cc')
-rw-r--r-- | sql/rpl_gtid.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc index f17ece298d3..b57eb208580 100644 --- a/sql/rpl_gtid.cc +++ b/sql/rpl_gtid.cc @@ -1911,10 +1911,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))) @@ -1922,6 +1926,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) { @@ -1936,6 +1942,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; } |