-
unknown authored
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.
4869f022