summaryrefslogtreecommitdiff
path: root/sql/rpl_rli.h
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2014-01-08 11:00:44 +0100
committerunknown <knielsen@knielsen-hq.org>2014-01-08 11:00:44 +0100
commit8cc6e90d74f4377491bcb7a0f1acd41ccf9fbcae (patch)
tree9d9878767d72068230ba15fc934259524b81c34d /sql/rpl_rli.h
parentbfdbb17990b198ff2a7e5eda5e2a365a1c6d8906 (diff)
downloadmariadb-git-8cc6e90d74f4377491bcb7a0f1acd41ccf9fbcae.tar.gz
MDEV-5509: Seconds_behind_master incorrect in parallel replication
The problem was a race between the SQL driver thread and the worker threads. The SQL driver thread would set rli->last_master_timestamp to zero to mark that it has caught up with the master, while the worker threads would set it to the timestamp of the executed event. This can happen out-of-order in parallel replication, causing the "caught up" status to be overwritten and Seconds_Behind_Master to wrongly grow when the slave is idle. To fix, introduce a separate flag rli->sql_thread_caught_up to mark that the SQL driver thread is caught up. This avoids issues with worker threads overwriting the SQL driver thread status. In parallel replication, we then make SHOW SLAVE STATUS check in addition that all worker threads are idle before showing Seconds_Behind_Master as 0 due to slave idle.
Diffstat (limited to 'sql/rpl_rli.h')
-rw-r--r--sql/rpl_rli.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index ff2ffd0b366..6716718d354 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -221,6 +221,12 @@ public:
bool sql_force_rotate_relay;
time_t last_master_timestamp;
+ /*
+ The SQL driver thread sets this true while it is waiting at the end of the
+ relay log for more events to arrive. SHOW SLAVE STATUS uses this to report
+ Seconds_Behind_Master as zero while the SQL thread is so waiting.
+ */
+ bool sql_thread_caught_up;
void clear_until_condition();