summaryrefslogtreecommitdiff
path: root/sql/rpl_gtid.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2015-11-29 17:51:23 +0200
committerMonty <monty@mariadb.org>2015-11-29 17:51:23 +0200
commitc3018b0ff4fb02c029787d03867adf0530607bab (patch)
treec3497838c222af9445a16312ecbd0e78ebc62f66 /sql/rpl_gtid.cc
parent654547b5b4b21aec719a84149595464364c96eea (diff)
downloadmariadb-git-c3018b0ff4fb02c029787d03867adf0530607bab.tar.gz
Fixes to get all test to run on MacosX Lion 10.7
This includes fixing all utilities to not have any memory leaks, as safemalloc warnings stopped tests from passing on MacOSX. - Ensure that all clients takes character-set-dir, as the libmysqlclient library will use it. - mysql-test-run now passes character-set-dir to all external clients. - Changed dynstr_free() so that it can be called twice (made freeing code easier) - Changed rpl_global_gtid_slave_state to be allocated dynamicly as it includes a mutex that needs to be initizlied/destroyed before my_end() is called. - Removed rpl_slave_state::init() and rpl_slave_stage::deinit() as their job are better handling by constructor and delete. - Print alias instead of table_name in check_duplicate_key as table_name may have been converted to lower case. Other things: - Fixed a case in time_to_datetime_with_warn() where we where using && instead of & in tests
Diffstat (limited to 'sql/rpl_gtid.cc')
-rw-r--r--sql/rpl_gtid.cc42
1 files changed, 14 insertions, 28 deletions
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index 77645fd3c7a..683f2492097 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -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);
}
@@ -252,15 +254,9 @@ 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);
+ mysql_mutex_destroy(&LOCK_slave_state);
}
@@ -285,16 +281,6 @@ rpl_slave_state::truncate_hash()
my_hash_reset(&hash);
}
-void
-rpl_slave_state::deinit()
-{
- if (!inited)
- return;
- truncate_hash();
- my_hash_free(&hash);
- mysql_mutex_destroy(&LOCK_slave_state);
-}
-
int
rpl_slave_state::update(uint32 domain_id, uint32 server_id, uint64 sub_id,
@@ -2097,16 +2083,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)
@@ -2123,7 +2109,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)
@@ -2135,7 +2121,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
{
@@ -2160,7 +2146,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
{
@@ -2170,7 +2156,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)
{
@@ -2180,7 +2166,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;
/*