Commit da47c037 authored by Monty's avatar Monty

Fixed calculating of last_master_timestamp for parallel replication.

This effects the Seconds_Behind_Master value.
parent 3655cefc
......@@ -564,6 +564,10 @@ class Relay_log_info : public Slave_reporting_capability
Guarded by data_lock. Written by the sql thread. Read by client
threads executing SHOW SLAVE STATUS.
This is calculated as:
clock_time_for_event_on_master + clock_difference_between_master_and_slave +
SQL_DELAY.
*/
time_t sql_delay_end;
......
......@@ -4342,6 +4342,13 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
rli->last_inuse_relaylog->dequeued_count))) &&
event_can_update_last_master_timestamp(ev))
{
/*
This is the first event from the master after the slave was up to date
and has been waiting for new events.
We update last_master_timestamp before executing the event to not
have Seconds_after_master == 0 while executing the event.
last_master_timestamp will be updated again when the event is commited.
*/
if (rli->last_master_timestamp < ev->when)
{
rli->last_master_timestamp= ev->when;
......@@ -4378,7 +4385,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
Seconds_Behind_Master is zero.
*/
if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT &&
rli->last_master_timestamp < ev->when)
rli->last_master_timestamp < ev->when + (time_t) ev->exec_time)
rli->last_master_timestamp= ev->when + (time_t) ev->exec_time;
DBUG_ASSERT(rli->last_master_timestamp >= 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment