summaryrefslogtreecommitdiff
path: root/sql/rpl_rli.cc
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2014-12-01 13:53:57 +0100
committerKristian Nielsen <knielsen@knielsen-hq.org>2014-12-01 13:53:57 +0100
commit52b25934d7fcf552a955078ccb6b19bef18e99d8 (patch)
tree57511693fbda05a4872565d8faa4c74a4079f084 /sql/rpl_rli.cc
parentf8e1952be4cb0736d89a8aed57e872b242a7a2c1 (diff)
downloadmariadb-git-52b25934d7fcf552a955078ccb6b19bef18e99d8.tar.gz
MDEV-7237: Parallel replication: incorrect relaylog position after stop/start the slave
The replication relay log position was sometimes updated incorrectly at the end of a transaction in parallel replication. This happened because the relay log file name was taken from the current Relay_log_info (SQL driver thread), not the correct value for the transaction in question. The result was that if a transaction was applied while the SQL driver thread was at least one relay log file ahead, _and_ the SQL thread was subsequently stopped before applying any events from the most recent relay log file, then the relay log position would be incorrect - wrong relay log file name. Thus, when the slave was started again, usually a relay log read error would result, or in rare cases, if the position happened to be readable, the slave might even skip arbitrary amounts of events. In GTID mode, the relay log position is reset when both slave threads are restarted, so this bug would only be seen in non-GTID mode, or in GTID mode when only the SQL thread, not the IO thread, was stopped.
Diffstat (limited to 'sql/rpl_rli.cc')
-rw-r--r--sql/rpl_rli.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 673a8c7ca4f..629e046ed0a 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -986,11 +986,11 @@ void Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos,
if (rgi->is_parallel_exec)
{
/* In case of parallel replication, do not update the position backwards. */
- int cmp= strcmp(group_relay_log_name, event_relay_log_name);
+ int cmp= strcmp(group_relay_log_name, rgi->event_relay_log_name);
if (cmp < 0)
{
group_relay_log_pos= rgi->future_event_relay_log_pos;
- strmake_buf(group_relay_log_name, event_relay_log_name);
+ strmake_buf(group_relay_log_name, rgi->event_relay_log_name);
notify_group_relay_log_name_update();
} else if (cmp == 0 && group_relay_log_pos < rgi->future_event_relay_log_pos)
group_relay_log_pos= rgi->future_event_relay_log_pos;