diff options
author | unknown <guilhem@mysql.com> | 2004-03-02 22:38:14 +0100 |
---|---|---|
committer | unknown <guilhem@mysql.com> | 2004-03-02 22:38:14 +0100 |
commit | 442677382f70f3b85c6d97b42e1dce49e69dfa1c (patch) | |
tree | 77280e0273d5f6fc56ee7001b7749a2fc2a11f70 /sql/slave.cc | |
parent | 1911544c6969db76f8db111ac79437796348cc00 (diff) | |
download | mariadb-git-442677382f70f3b85c6d97b42e1dce49e69dfa1c.tar.gz |
After hours of unsuccessful research on
BUG#2826 "Seconds behind master weirdness"
(sometimes this column of SHOW SLAVE STATUS shows a very big value,
in fact a small negative number casted to ulonglong).
This problem was reported by only one user, but which uses
synchronized time between his servers.
As suggested by the user, to hide this I display max(0, the value)
so that it will be less confusing. For a user, seeing 0 is probably
better than seeing -1 (both tell you that the slave is very close
to the master).
sql/slave.cc:
Don't display a negative Seconds_Behind_Master in SHOW SLAVE STATUS.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index bbf1741183b..ed16c3361c6 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2060,10 +2060,16 @@ int show_master_info(THD* thd, MASTER_INFO* mi) protocol->store(mi->ssl_key, &my_charset_bin); if (mi->rli.last_master_timestamp) - protocol->store((ulonglong) - (long)((time_t)time((time_t*) 0) - - mi->rli.last_master_timestamp) - - mi->clock_diff_with_master); + { + long tmp= (long)((time_t)time((time_t*) 0) + - mi->rli.last_master_timestamp) + - mi->clock_diff_with_master; + /* + Apparently on some systems tmp can be <0 (which is still a + mistery). This confuses users, so we don't go below 0. + */ + protocol->store((longlong)(max(0, tmp))); + } else protocol->store_null(); |