summaryrefslogtreecommitdiff
path: root/sql/rpl_parallel.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-12-21 21:24:22 +0100
committerSergei Golubchik <serg@mariadb.org>2015-12-21 21:24:22 +0100
commita2bcee626d4ef2836e38e4932305871390164644 (patch)
treeb41e357427318bad8985078b91bbd2b0360defc8 /sql/rpl_parallel.cc
parent1788bfe93a745582d938a608d5959b7d2e6b2f23 (diff)
parent4fdf25afa8188905653a83e08fc387243e584600 (diff)
downloadmariadb-git-a2bcee626d4ef2836e38e4932305871390164644.tar.gz
Merge branch '10.0' into 10.1
Diffstat (limited to 'sql/rpl_parallel.cc')
-rw-r--r--sql/rpl_parallel.cc23
1 files changed, 16 insertions, 7 deletions
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc
index 526c3ec7a92..b4e7b1a89dd 100644
--- a/sql/rpl_parallel.cc
+++ b/sql/rpl_parallel.cc
@@ -351,6 +351,7 @@ do_ftwrl_wait(rpl_group_info *rgi,
THD *thd= rgi->thd;
rpl_parallel_entry *entry= rgi->parallel_entry;
uint64 sub_id= rgi->gtid_sub_id;
+ DBUG_ENTER("do_ftwrl_wait");
mysql_mutex_assert_owner(&entry->LOCK_parallel_entry);
@@ -390,6 +391,8 @@ do_ftwrl_wait(rpl_group_info *rgi,
if (sub_id > entry->largest_started_sub_id)
entry->largest_started_sub_id= sub_id;
+
+ DBUG_VOID_RETURN;
}
@@ -453,6 +456,7 @@ rpl_unpause_after_ftwrl(THD *thd)
{
uint32 i;
rpl_parallel_thread_pool *pool= &global_rpl_thread_pool;
+ DBUG_ENTER("rpl_unpause_after_ftwrl");
DBUG_ASSERT(pool->busy);
@@ -477,6 +481,7 @@ rpl_unpause_after_ftwrl(THD *thd)
}
pool_mark_not_busy(pool);
+ DBUG_VOID_RETURN;
}
@@ -491,6 +496,7 @@ rpl_pause_for_ftwrl(THD *thd)
uint32 i;
rpl_parallel_thread_pool *pool= &global_rpl_thread_pool;
int err;
+ DBUG_ENTER("rpl_pause_for_ftwrl");
/*
While the count_pending_pause_for_ftwrl counter is non-zero, the pool
@@ -501,7 +507,7 @@ rpl_pause_for_ftwrl(THD *thd)
as this can deadlock against release_thread()).
*/
if ((err= pool_mark_busy(pool, thd)))
- return err;
+ DBUG_RETURN(err);
for (i= 0; i < pool->count; ++i)
{
@@ -548,7 +554,7 @@ rpl_pause_for_ftwrl(THD *thd)
if (err)
rpl_unpause_after_ftwrl(thd);
- return err;
+ DBUG_RETURN(err);
}
@@ -1134,7 +1140,7 @@ handle_rpl_parallel_thread(void *arg)
if (opt_gtid_ignore_duplicates)
{
int res=
- rpl_global_gtid_slave_state.check_duplicate_gtid(&rgi->current_gtid,
+ rpl_global_gtid_slave_state->check_duplicate_gtid(&rgi->current_gtid,
rgi);
if (res < 0)
{
@@ -1311,8 +1317,9 @@ handle_rpl_parallel_thread(void *arg)
*/
mysql_mutex_lock(&rpt->current_entry->LOCK_parallel_entry);
mysql_mutex_unlock(&rpt->LOCK_rpl_thread);
- mysql_cond_wait(&rpt->current_entry->COND_parallel_entry,
- &rpt->current_entry->LOCK_parallel_entry);
+ if (rpt->pause_for_ftwrl)
+ mysql_cond_wait(&rpt->current_entry->COND_parallel_entry,
+ &rpt->current_entry->LOCK_parallel_entry);
mysql_mutex_unlock(&rpt->current_entry->LOCK_parallel_entry);
mysql_mutex_lock(&rpt->LOCK_rpl_thread);
/*
@@ -1349,7 +1356,7 @@ handle_rpl_parallel_thread(void *arg)
/* Tell wait_for_done() that we are done, if it is waiting. */
if (likely(rpt->current_entry) &&
unlikely(rpt->current_entry->force_abort))
- mysql_cond_broadcast(&rpt->current_entry->COND_parallel_entry);
+ mysql_cond_broadcast(&rpt->COND_rpl_thread_stop);
rpt->current_entry= NULL;
if (!rpt->stop)
rpt->pool->release_thread(rpt);
@@ -1430,6 +1437,8 @@ rpl_parallel_change_thread_count(rpl_parallel_thread_pool *pool,
mysql_cond_init(key_COND_rpl_thread, &new_list[i]->COND_rpl_thread, NULL);
mysql_cond_init(key_COND_rpl_thread_queue,
&new_list[i]->COND_rpl_thread_queue, NULL);
+ mysql_cond_init(key_COND_rpl_thread_stop,
+ &new_list[i]->COND_rpl_thread_stop, NULL);
new_list[i]->pool= pool;
if (mysql_thread_create(key_rpl_parallel_thread, &th, &connection_attrib,
handle_rpl_parallel_thread, new_list[i]))
@@ -2143,7 +2152,7 @@ rpl_parallel::wait_for_done(THD *thd, Relay_log_info *rli)
{
mysql_mutex_lock(&rpt->LOCK_rpl_thread);
while (rpt->current_owner == &e->rpl_threads[j])
- mysql_cond_wait(&e->COND_parallel_entry, &rpt->LOCK_rpl_thread);
+ mysql_cond_wait(&rpt->COND_rpl_thread_stop, &rpt->LOCK_rpl_thread);
mysql_mutex_unlock(&rpt->LOCK_rpl_thread);
}
}