1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

bzr merge -r3928..3932 codership/5.5

This commit is contained in:
Nirbhay Choubey
2014-03-25 13:39:12 -04:00
parent 7b57c5ea6f
commit 3c0b3babd9
4 changed files with 40 additions and 5 deletions

View File

@ -2721,7 +2721,9 @@ mysql_execute_command(THD *thd)
if (trans_commit_implicit(thd)) if (trans_commit_implicit(thd))
{ {
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
#ifdef WITH_WSREP
WSREP_DEBUG("implicit commit failed, MDL released: %lu", thd->thread_id); WSREP_DEBUG("implicit commit failed, MDL released: %lu", thd->thread_id);
#endif /* WITH_WSREP */
goto error; goto error;
} }
/* Release metadata locks acquired in this transaction. */ /* Release metadata locks acquired in this transaction. */
@ -4711,7 +4713,9 @@ end_with_restore_list:
if (trans_begin(thd, lex->start_transaction_opt)) if (trans_begin(thd, lex->start_transaction_opt))
{ {
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
#ifdef WITH_WSREP
WSREP_DEBUG("BEGIN failed, MDL released: %lu", thd->thread_id); WSREP_DEBUG("BEGIN failed, MDL released: %lu", thd->thread_id);
#endif /* WITH_WSREP */
goto error; goto error;
} }
my_ok(thd); my_ok(thd);
@ -4729,7 +4733,9 @@ end_with_restore_list:
if (trans_commit(thd)) if (trans_commit(thd))
{ {
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
#ifdef WITH_WSREP
WSREP_DEBUG("COMMIT failed, MDL released: %lu", thd->thread_id); WSREP_DEBUG("COMMIT failed, MDL released: %lu", thd->thread_id);
#endif /* WITH_WSREP */
goto error; goto error;
} }
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
@ -4755,9 +4761,9 @@ end_with_restore_list:
if (WSREP(thd)) { if (WSREP(thd)) {
if (thd->wsrep_conflict_state == NO_CONFLICT || if (thd->wsrep_conflict_state == NO_CONFLICT ||
thd->wsrep_conflict_state == REPLAYING) thd->wsrep_conflict_state == REPLAYING)
{ {
my_ok(thd); my_ok(thd);
} }
} else { } else {
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
@ -4780,7 +4786,9 @@ end_with_restore_list:
if (trans_rollback(thd)) if (trans_rollback(thd))
{ {
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
#ifdef WITH_WSREP
WSREP_DEBUG("rollback failed, MDL released: %lu", thd->thread_id); WSREP_DEBUG("rollback failed, MDL released: %lu", thd->thread_id);
#endif /* WITH_WSREP */
goto error; goto error;
} }
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
@ -4802,7 +4810,7 @@ end_with_restore_list:
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (WSREP(thd)) { if (WSREP(thd)) {
if (thd->wsrep_conflict_state == NO_CONFLICT) { if (thd->wsrep_conflict_state == NO_CONFLICT) {
my_ok(thd); my_ok(thd);
} }
} else { } else {
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
@ -5327,7 +5335,9 @@ create_sp_error:
if (trans_xa_commit(thd)) if (trans_xa_commit(thd))
{ {
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
#ifdef WITH_WSREP
WSREP_DEBUG("XA commit failed, MDL released: %lu", thd->thread_id); WSREP_DEBUG("XA commit failed, MDL released: %lu", thd->thread_id);
#endif /* WITH_WSREP */
goto error; goto error;
} }
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
@ -5343,7 +5353,9 @@ create_sp_error:
if (trans_xa_rollback(thd)) if (trans_xa_rollback(thd))
{ {
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
#ifdef WITH_WSREP
WSREP_DEBUG("XA rollback failed, MDL released: %lu", thd->thread_id); WSREP_DEBUG("XA rollback failed, MDL released: %lu", thd->thread_id);
#endif /* WITH_WSREP */
goto error; goto error;
} }
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();

View File

@ -3190,7 +3190,9 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type)
{ {
thd->variables.option_bits&= ~OPTION_AUTOCOMMIT; thd->variables.option_bits&= ~OPTION_AUTOCOMMIT;
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
#ifdef WITH_WSREP
WSREP_DEBUG("autocommit, MDL TRX lock released: %lu", thd->thread_id); WSREP_DEBUG("autocommit, MDL TRX lock released: %lu", thd->thread_id);
#endif /* WITH_WSREP */
return true; return true;
} }
/* /*

View File

@ -407,14 +407,26 @@ void wsrep_ready_wait ()
static void wsrep_synced_cb(void* app_ctx) static void wsrep_synced_cb(void* app_ctx)
{ {
WSREP_INFO("Synchronized with group, ready for connections"); WSREP_INFO("Synchronized with group, ready for connections");
bool signal_main= false;
if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort(); if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort();
if (!wsrep_ready) if (!wsrep_ready)
{ {
wsrep_ready= TRUE; wsrep_ready= TRUE;
mysql_cond_signal (&COND_wsrep_ready); mysql_cond_signal (&COND_wsrep_ready);
signal_main= true;
} }
local_status.set(WSREP_MEMBER_SYNCED); local_status.set(WSREP_MEMBER_SYNCED);
mysql_mutex_unlock (&LOCK_wsrep_ready); mysql_mutex_unlock (&LOCK_wsrep_ready);
if (signal_main)
{
wsrep_SE_init_grab();
// Signal mysqld init thread to continue
wsrep_sst_complete (&local_uuid, local_seqno, false);
// and wait for SE initialization
wsrep_SE_init_wait();
}
} }
static void wsrep_init_position() static void wsrep_init_position()

View File

@ -231,7 +231,13 @@ void wsrep_sst_complete (const wsrep_uuid_t* sst_uuid,
} }
else else
{ {
WSREP_WARN("Nobody is waiting for SST."); /* This can happen when called from wsrep_synced_cb().
At the moment there is no way to check there
if main thread is still waiting for signal,
so wsrep_sst_complete() is called from there
each time wsrep_ready changes from FALSE -> TRUE.
*/
WSREP_DEBUG("Nobody is waiting for SST.");
} }
mysql_mutex_unlock (&LOCK_wsrep_sst); mysql_mutex_unlock (&LOCK_wsrep_sst);
} }
@ -1049,7 +1055,10 @@ void wsrep_SE_init_grab()
void wsrep_SE_init_wait() void wsrep_SE_init_wait()
{ {
mysql_cond_wait (&COND_wsrep_sst_init, &LOCK_wsrep_sst_init); while (SE_initialized == false)
{
mysql_cond_wait (&COND_wsrep_sst_init, &LOCK_wsrep_sst_init);
}
mysql_mutex_unlock (&LOCK_wsrep_sst_init); mysql_mutex_unlock (&LOCK_wsrep_sst_init);
} }