summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-12-16 18:12:22 +0100
committerunknown <guilhem@mysql.com>2004-12-16 18:12:22 +0100
commit4869f022fd4761445843135102790691e8d48861 (patch)
tree747ea547f2e4eb2f3ee55054dac260feb2f91c5b /sql/sql_repl.cc
parent730e2722fffd9cb7086770e7652cebc932c4c261 (diff)
downloadmariadb-git-4869f022fd4761445843135102790691e8d48861.tar.gz
A change of behaviour of Seconds_Behind_Master from SHOW SLAVE STATUS. It's going into 4.1
because old behaviour was somewhat nonsensical (kind of bug). Changes are that if repl threads are down or disconnected the column will be NULL, and if master is idle the column will not grow indefinitely anymore. sql/slave.cc: mi->slave_running and rli->slave_running now uints (was needed only for mi but because of start_slave_thread() usage, had to change both). So mi->slave_running can now take 3 values: not running, running & not connected, running and connected. The last value serves for calculation of Seconds_Behind_Master in SHOW SLAVE STATUS. Changing this column's behaviour: if SQL or I/O thread is not running, or if I/O thread is not connected (for example if it is reconnecting), it's NULL (to mean "unknown"). And if master is idle, the column will not grow indefinitely like it used to (that was meaningless); this is fixed by forcing a value of 0 when the slave SQL thread has hit EOF of relay log (which has only a limited number of caveats explained in comments in code). sql/slave.h: slave_running used to be bool but we need to distinguish, for the I/O slave thread, between "running & connected" and "running & not connected" ("running" means the thread exists). sql/sql_repl.cc: we don't need anymore to set rli->last_master_timestamp to 0 (we used that to make Seconds_Behind_Master be NULL) in RESET SLAVE and CHANGE MASTER, as these commands imply that slave threads are not running and so Seconds_Behind_Master is already NULL because of that.
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 6854cb24ee9..2f0d8d3aa0d 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -880,10 +880,10 @@ int reset_slave(THD *thd, MASTER_INFO* mi)
*/
init_master_info_with_options(mi);
/*
- Reset errors, and master timestamp (the idea is that we forget about the
+ Reset errors (the idea is that we forget about the
old master).
*/
- clear_slave_error_timestamp(&mi->rli);
+ clear_slave_error(&mi->rli);
clear_until_condition(&mi->rli);
// close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0
@@ -1143,8 +1143,8 @@ int change_master(THD* thd, MASTER_INFO* mi)
pthread_mutex_lock(&mi->rli.data_lock);
mi->rli.abort_pos_wait++; /* for MASTER_POS_WAIT() to abort */
- /* Clear the errors, for a clean start, and master timestamp */
- clear_slave_error_timestamp(&mi->rli);
+ /* Clear the errors, for a clean start */
+ clear_slave_error(&mi->rli);
clear_until_condition(&mi->rli);
/*
If we don't write new coordinates to disk now, then old will remain in