summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-12-16 22:38:42 +0100
committerunknown <guilhem@mysql.com>2004-12-16 22:38:42 +0100
commit082bf702a575ddfef7e7688275d920b7a6c12e21 (patch)
treeaf2330da2c9eb2ea8597179b16e4aa22b15e1043
parent93f82e8ebf7855ce9b4ecb903f5a49e5fe079090 (diff)
downloadmariadb-git-082bf702a575ddfef7e7688275d920b7a6c12e21.tar.gz
Very minor fixes for Seconds_Behind_Master column of SHOW SLAVE STATUS.
sql/log_event.cc: comment sql/slave.cc: putting setting of rli->last_master_timestamp a few lines above, so that it is done under rli->data_lock.
-rw-r--r--sql/log_event.cc3
-rw-r--r--sql/slave.cc29
2 files changed, 18 insertions, 14 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 087e58a7bad..c027c3a8ee4 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -373,6 +373,9 @@ int Log_event::exec_event(struct st_relay_log_info* rli)
Note that Rotate_log_event::exec_event() does not call this function,
so there is no chance that a fake rotate event resets
last_master_timestamp.
+ Note that we update without mutex (probably ok - except in some very
+ rare cases, only consequence is that value may take some time to
+ display in Seconds_Behind_Master - not critical).
*/
rli->last_master_timestamp= when;
}
diff --git a/sql/slave.cc b/sql/slave.cc
index 90c75243f3d..ef9caa5f5b5 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -4189,6 +4189,21 @@ Before assert, my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s",
*/
if (hot_log)
{
+ /*
+ We say in Seconds_Behind_Master that we have "caught up". Note that
+ for example if network link is broken but I/O slave thread hasn't
+ noticed it (slave_net_timeout not elapsed), then we'll say "caught
+ up" whereas we're not really caught up. Fixing that would require
+ internally cutting timeout in smaller pieces in network read, no
+ thanks. Another example: SQL has caught up on I/O, now I/O has read
+ a new event and is queuing it; the false "0" will exist until SQL
+ finishes executing the new event; it will be look abnormal only if
+ the events have old timestamps (then you get "many", 0, "many").
+ Transient phases like this can't really be fixed.
+ */
+ time_t save_timestamp= rli->last_master_timestamp;
+ rli->last_master_timestamp= 0;
+
DBUG_ASSERT(rli->relay_log.get_open_count() == rli->cur_log_old_open_count);
/*
We can, and should release data_lock while we are waiting for
@@ -4231,20 +4246,6 @@ Before assert, my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s",
*/
pthread_mutex_unlock(&rli->log_space_lock);
pthread_cond_broadcast(&rli->log_space_cond);
- /*
- We say in Seconds_Behind_Master that we have "caught up". Note that
- for example if network link is broken but I/O slave thread hasn't
- noticed it (slave_net_timeout not elapsed), then we'll say "caught
- up" whereas we're not really caught up. Fixing that would require
- internally cutting timeout in smaller pieces in network read, no
- thanks. Another example: SQL has caught up on I/O, now I/O has read
- a new event and is queuing it; the false "0" will exist until SQL
- finishes executing the new event; it will be look abnormal only if
- the events have old timestamps (then you get "many", 0, "many").
- Transient phases like this can't really be fixed.
- */
- time_t save_timestamp= rli->last_master_timestamp;
- rli->last_master_timestamp= 0;
// Note that wait_for_update unlocks lock_log !
rli->relay_log.wait_for_update(rli->sql_thd, 1);
// re-acquire data lock since we released it earlier