summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2014-03-09 10:27:38 +0100
committerunknown <knielsen@knielsen-hq.org>2014-03-09 10:27:38 +0100
commit2c2478b82260f5110ea2c5bed3c6c7bcd3558453 (patch)
tree24a7a88645c37c46f734869cb8b593ea6ea4dfec /sql/log_event.cc
parent5c31e79f8bba85e555dac2e2f6e97cc1b0a2b51b (diff)
downloadmariadb-git-2c2478b82260f5110ea2c5bed3c6c7bcd3558453.tar.gz
MDEV-5804: If same GTID is received on multiple master connections in multi-source replication, the event is double-executed causing corruption or replication failure
Before, the arrival of same GTID twice in multi-source replication would cause double-apply or in gtid strict mode an error. Keep the behaviour, but add an option --gtid-ignore-duplicates which allows to correctly handle duplicates, ignoring all but the first. This relies on the user ensuring correct configuration so that sequence numbers are strictly increasing within each replication domain; then duplicates can be detected simply by comparing the sequence numbers against what is already applied. Only one master connection (but possibly multiple parallel worker threads within that connection) is allowed to apply events within one replication domain at a time; any other connection that receives a GTID in the same domain either discards it (if it is already applied) or waits for the other connection to not have any events to apply. Intermediate patch, as proof-of-concept for testing. The main limitation is that currently it is only implemented for parallel replication, @@slave_parallel_threads > 0.
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index f3f6d7a5d38..98524d73433 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -4440,7 +4440,7 @@ Default database: '%s'. Query: '%s'",
end:
if (sub_id && !thd->is_slave_error)
- rpl_global_gtid_slave_state.update_state_hash(sub_id, &gtid);
+ rpl_global_gtid_slave_state.update_state_hash(sub_id, &gtid, rli);
/*
Probably we have set thd->query, thd->db, thd->catalog to point to places
@@ -6806,7 +6806,8 @@ Gtid_list_log_event::do_apply_event(rpl_group_info *rgi)
sub_id_list[i],
false, false)))
return ret;
- rpl_global_gtid_slave_state.update_state_hash(sub_id_list[i], &list[i]);
+ rpl_global_gtid_slave_state.update_state_hash(sub_id_list[i], &list[i],
+ NULL);
}
}
ret= Log_event::do_apply_event(rgi);
@@ -7326,7 +7327,7 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
thd->mdl_context.release_transactional_locks();
if (!res && sub_id)
- rpl_global_gtid_slave_state.update_state_hash(sub_id, &gtid);
+ rpl_global_gtid_slave_state.update_state_hash(sub_id, &gtid, rli);
/*
Increment the global status commit count variable