diff options
-rw-r--r-- | sql/rpl_gtid.cc | 13 | ||||
-rw-r--r-- | sql/rpl_gtid.h | 4 | ||||
-rw-r--r-- | sql/rpl_parallel.cc | 4 |
3 files changed, 10 insertions, 11 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; diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h index 525b34cb160..39c9aee0b9d 100644 --- a/sql/rpl_gtid.h +++ b/sql/rpl_gtid.h @@ -60,7 +60,6 @@ struct rpl_slave_state struct element { struct list_element *list; - uint64 last_sub_id; uint32 domain_id; list_element *grab_list() { list_element *l= list; list= NULL; return l; } @@ -68,8 +67,6 @@ struct rpl_slave_state { l->next= list; list= l; - if (last_sub_id < l->sub_id) - last_sub_id= l->sub_id; } }; @@ -78,6 +75,7 @@ struct rpl_slave_state /* Mutex protecting access to the state. */ mysql_mutex_t LOCK_slave_state; + uint64 last_sub_id; bool inited; bool loaded; diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index e1d8b3a2f0c..e65c543148e 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -657,8 +657,10 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev, if (typ == GTID_EVENT) { Gtid_log_event *gtid_ev= static_cast<Gtid_log_event *>(ev); + uint32 domain_id= (rli->mi->using_gtid == Master_info::USE_GTID_NO ? + 0 : gtid_ev->domain_id); - if (!(e= find(gtid_ev->domain_id)) || + if (!(e= find(domain_id)) || !(rgi= new rpl_group_info(rli)) || event_group_new_gtid(rgi, gtid_ev)) { |