diff options
author | Kristian Nielsen <knielsen@knielsen-hq.org> | 2015-10-22 10:28:51 +0200 |
---|---|---|
committer | Kristian Nielsen <knielsen@knielsen-hq.org> | 2015-11-13 10:24:53 +0100 |
commit | 75dc2671011ba53e4f4531752c213ced7f9012ff (patch) | |
tree | 1fda725bc4315c4190a9c39917791788788b05ef /sql/rpl_rli.cc | |
parent | e7cb032e560e14865941ecdcb553cd3aba856b68 (diff) | |
download | mariadb-git-75dc2671011ba53e4f4531752c213ced7f9012ff.tar.gz |
Change Seconds_behind_master to be updated only at commit in parallel replication
Before, the Seconds_behind_master was updated already when an event
was queued for a worker thread to execute later. This might lead users
to interpret a low value as the slave being almost up to date with the
master, while in reality there might still be lots and lots of events
still queued up waiting to be applied by the slave.
See https://lists.launchpad.net/maria-developers/msg08958.html for
more detailed discussions.
Diffstat (limited to 'sql/rpl_rli.cc')
-rw-r--r-- | sql/rpl_rli.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 8a2a55fcde0..3b2fea93c3b 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1001,6 +1001,18 @@ void Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos, else if (group_master_log_pos < log_pos) group_master_log_pos= log_pos; } + + /* + In the parallel case, we only update the Seconds_Behind_Master at the + end of a transaction. In the non-parallel case, the value is updated as + soon as an event is read from the relay log; however this would be too + confusing for the user, seeing the slave reported as up-to-date when + potentially thousands of events are still queued up for worker threads + waiting for execution. + */ + if (rgi->last_master_timestamp && + rgi->last_master_timestamp > last_master_timestamp) + last_master_timestamp= rgi->last_master_timestamp; } else { @@ -1630,6 +1642,7 @@ rpl_group_info::reinit(Relay_log_info *rli) row_stmt_start_timestamp= 0; long_find_row_note_printed= false; did_mark_start_commit= false; + last_master_timestamp = 0; gtid_ignore_duplicate_state= GTID_DUPLICATE_NULL; commit_orderer.reinit(); } |