diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-12-21 21:24:22 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-12-21 21:24:22 +0100 |
commit | a2bcee626d4ef2836e38e4932305871390164644 (patch) | |
tree | b41e357427318bad8985078b91bbd2b0360defc8 /sql/rpl_gtid.cc | |
parent | 1788bfe93a745582d938a608d5959b7d2e6b2f23 (diff) | |
parent | 4fdf25afa8188905653a83e08fc387243e584600 (diff) | |
download | mariadb-git-a2bcee626d4ef2836e38e4932305871390164644.tar.gz |
Merge branch '10.0' into 10.1
Diffstat (limited to 'sql/rpl_gtid.cc')
-rw-r--r-- | sql/rpl_gtid.cc | 46 |
1 files changed, 16 insertions, 30 deletions
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc index 33cf78b6508..90d750c38ad 100644 --- a/sql/rpl_gtid.cc +++ b/sql/rpl_gtid.cc @@ -122,7 +122,7 @@ rpl_slave_state::check_duplicate_gtid(rpl_gtid *gtid, rpl_group_info *rgi) int res; bool did_enter_cond= false; PSI_stage_info old_stage; - THD *thd; + THD *UNINIT_VAR(thd); Relay_log_info *rli= rgi->rli; mysql_mutex_lock(&LOCK_slave_state); @@ -243,8 +243,10 @@ rpl_slave_state_free_element(void *arg) rpl_slave_state::rpl_slave_state() - : last_sub_id(0), inited(false), loaded(false) + : last_sub_id(0), loaded(false) { + mysql_mutex_init(key_LOCK_slave_state, &LOCK_slave_state, + MY_MUTEX_INIT_SLOW); my_hash_init(&hash, &my_charset_bin, 32, offsetof(element, domain_id), sizeof(uint32), NULL, rpl_slave_state_free_element, HASH_UNIQUE); my_init_dynamic_array(>id_sort_array, sizeof(rpl_gtid), 8, 8, MYF(0)); @@ -253,15 +255,10 @@ rpl_slave_state::rpl_slave_state() rpl_slave_state::~rpl_slave_state() { -} - - -void -rpl_slave_state::init() -{ - DBUG_ASSERT(!inited); - mysql_mutex_init(key_LOCK_slave_state, &LOCK_slave_state, MY_MUTEX_INIT_SLOW); - inited= true; + truncate_hash(); + my_hash_free(&hash); + delete_dynamic(>id_sort_array); + mysql_mutex_destroy(&LOCK_slave_state); } @@ -286,17 +283,6 @@ rpl_slave_state::truncate_hash() my_hash_reset(&hash); } -void -rpl_slave_state::deinit() -{ - if (!inited) - return; - truncate_hash(); - my_hash_free(&hash); - delete_dynamic(>id_sort_array); - mysql_mutex_destroy(&LOCK_slave_state); -} - int rpl_slave_state::update(uint32 domain_id, uint32 server_id, uint64 sub_id, @@ -2197,16 +2183,16 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, uint64 wakeup_seq_no; queue_element *cur_waiter; - mysql_mutex_lock(&rpl_global_gtid_slave_state.LOCK_slave_state); + mysql_mutex_lock(&rpl_global_gtid_slave_state->LOCK_slave_state); /* The elements in the gtid_slave_state_hash are never re-allocated once they enter the hash, so we do not need to re-do the lookup after releasing and re-aquiring the lock. */ if (!slave_state_elem && - !(slave_state_elem= rpl_global_gtid_slave_state.get_element(domain_id))) + !(slave_state_elem= rpl_global_gtid_slave_state->get_element(domain_id))) { - mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state); + mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state); remove_from_wait_queue(he, &elem); promote_new_waiter(he); if (did_enter_cond) @@ -2223,7 +2209,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, We do not have to wait. (We will be removed from the wait queue when we call process_wait_hash() below. */ - mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state); + mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state); } else if ((cur_waiter= slave_state_elem->gtid_waiter) && slave_state_elem->min_wait_seq_no <= seq_no) @@ -2235,7 +2221,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, lock). */ elem.do_small_wait= false; - mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state); + mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state); } else { @@ -2260,7 +2246,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, else mysql_mutex_unlock(&LOCK_gtid_waiting); thd->ENTER_COND(&slave_state_elem->COND_wait_gtid, - &rpl_global_gtid_slave_state.LOCK_slave_state, + &rpl_global_gtid_slave_state->LOCK_slave_state, &stage_master_gtid_wait_primary, &old_stage); do { @@ -2270,7 +2256,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, { int err= mysql_cond_timedwait(&slave_state_elem->COND_wait_gtid, - &rpl_global_gtid_slave_state.LOCK_slave_state, + &rpl_global_gtid_slave_state->LOCK_slave_state, wait_until); if (err == ETIMEDOUT || err == ETIME) { @@ -2280,7 +2266,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, } else mysql_cond_wait(&slave_state_elem->COND_wait_gtid, - &rpl_global_gtid_slave_state.LOCK_slave_state); + &rpl_global_gtid_slave_state->LOCK_slave_state); } while (slave_state_elem->gtid_waiter == &elem); wakeup_seq_no= slave_state_elem->highest_seq_no; /* |