diff options
author | unknown <knielsen@knielsen-hq.org> | 2013-10-25 21:17:14 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2013-10-25 21:17:14 +0200 |
commit | 6a38b594759c41bd3d45ad89379ff38864bd4ba4 (patch) | |
tree | d64dc292005a98e5ade6e943fb5aed1eda3ee0f0 /sql/rpl_gtid.cc | |
parent | 80d0dd7babb5ade8345cdd7065e8f9ef6b65e3da (diff) | |
download | mariadb-git-6a38b594759c41bd3d45ad89379ff38864bd4ba4.tar.gz |
MDEV-5189: Incorrect parallel apply in parallel replication
Two problems were fixed:
1. When not in GTID mode (master_use_gtid=no), then we must not apply events
in different domains in parallel (in non-GTID mode we are not capable of
restarting at different points in different domains).
2. When transactions B and C group commit together, but after and separate
from A, we can apply B and C in parallel, but both B and C must not start
until A has committed. Fix sub_id to be globally increasing (not just
per-domain increasing) so that this wait (which is based on sub_id) can be
done correctly.
Diffstat (limited to 'sql/rpl_gtid.cc')
-rw-r--r-- | sql/rpl_gtid.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc index 1e393eab502..da90dcf641a 100644 --- a/sql/rpl_gtid.cc +++ b/sql/rpl_gtid.cc @@ -83,7 +83,7 @@ rpl_slave_state::record_and_update_gtid(THD *thd, rpl_group_info *rgi) rpl_slave_state::rpl_slave_state() - : inited(false), loaded(false) + : last_sub_id(0), inited(false), loaded(false) { my_hash_init(&hash, &my_charset_bin, 32, offsetof(element, domain_id), sizeof(uint32), NULL, my_free, HASH_UNIQUE); @@ -153,6 +153,9 @@ rpl_slave_state::update(uint32 domain_id, uint32 server_id, uint64 sub_id, list_elem->seq_no= seq_no; elem->add(list_elem); + if (last_sub_id < sub_id) + last_sub_id= sub_id; + return 0; } @@ -169,7 +172,6 @@ rpl_slave_state::get_element(uint32 domain_id) if (!(elem= (element *)my_malloc(sizeof(*elem), MYF(MY_WME)))) return NULL; elem->list= NULL; - elem->last_sub_id= 0; elem->domain_id= domain_id; if (my_hash_insert(&hash, (uchar *)elem)) { @@ -469,13 +471,10 @@ end: uint64 rpl_slave_state::next_subid(uint32 domain_id) { - uint32 sub_id= 0; - element *elem; + uint32 sub_id; lock(); - elem= get_element(domain_id); - if (elem) - sub_id= ++elem->last_sub_id; + sub_id= ++last_sub_id; unlock(); return sub_id; |