summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/sql_parse.cc18
-rw-r--r--sql/sys_vars.cc2
-rw-r--r--sql/wsrep_mysqld.cc12
-rw-r--r--sql/wsrep_sst.cc13
4 files changed, 40 insertions, 5 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 863658f7878..e3fa61d11e8 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2721,7 +2721,9 @@ mysql_execute_command(THD *thd)
if (trans_commit_implicit(thd))
{
thd->mdl_context.release_transactional_locks();
+#ifdef WITH_WSREP
WSREP_DEBUG("implicit commit failed, MDL released: %lu", thd->thread_id);
+#endif /* WITH_WSREP */
goto error;
}
/* Release metadata locks acquired in this transaction. */
@@ -4711,7 +4713,9 @@ end_with_restore_list:
if (trans_begin(thd, lex->start_transaction_opt))
{
thd->mdl_context.release_transactional_locks();
+#ifdef WITH_WSREP
WSREP_DEBUG("BEGIN failed, MDL released: %lu", thd->thread_id);
+#endif /* WITH_WSREP */
goto error;
}
my_ok(thd);
@@ -4729,7 +4733,9 @@ end_with_restore_list:
if (trans_commit(thd))
{
thd->mdl_context.release_transactional_locks();
+#ifdef WITH_WSREP
WSREP_DEBUG("COMMIT failed, MDL released: %lu", thd->thread_id);
+#endif /* WITH_WSREP */
goto error;
}
thd->mdl_context.release_transactional_locks();
@@ -4755,9 +4761,9 @@ end_with_restore_list:
if (WSREP(thd)) {
if (thd->wsrep_conflict_state == NO_CONFLICT ||
- thd->wsrep_conflict_state == REPLAYING)
+ thd->wsrep_conflict_state == REPLAYING)
{
- my_ok(thd);
+ my_ok(thd);
}
} else {
#endif /* WITH_WSREP */
@@ -4780,7 +4786,9 @@ end_with_restore_list:
if (trans_rollback(thd))
{
thd->mdl_context.release_transactional_locks();
+#ifdef WITH_WSREP
WSREP_DEBUG("rollback failed, MDL released: %lu", thd->thread_id);
+#endif /* WITH_WSREP */
goto error;
}
thd->mdl_context.release_transactional_locks();
@@ -4802,7 +4810,7 @@ end_with_restore_list:
#ifdef WITH_WSREP
if (WSREP(thd)) {
if (thd->wsrep_conflict_state == NO_CONFLICT) {
- my_ok(thd);
+ my_ok(thd);
}
} else {
#endif /* WITH_WSREP */
@@ -5327,7 +5335,9 @@ create_sp_error:
if (trans_xa_commit(thd))
{
thd->mdl_context.release_transactional_locks();
+#ifdef WITH_WSREP
WSREP_DEBUG("XA commit failed, MDL released: %lu", thd->thread_id);
+#endif /* WITH_WSREP */
goto error;
}
thd->mdl_context.release_transactional_locks();
@@ -5343,7 +5353,9 @@ create_sp_error:
if (trans_xa_rollback(thd))
{
thd->mdl_context.release_transactional_locks();
+#ifdef WITH_WSREP
WSREP_DEBUG("XA rollback failed, MDL released: %lu", thd->thread_id);
+#endif /* WITH_WSREP */
goto error;
}
thd->mdl_context.release_transactional_locks();
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index f7b44af4e8b..36e3791d9cf 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -3190,7 +3190,9 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type)
{
thd->variables.option_bits&= ~OPTION_AUTOCOMMIT;
thd->mdl_context.release_transactional_locks();
+#ifdef WITH_WSREP
WSREP_DEBUG("autocommit, MDL TRX lock released: %lu", thd->thread_id);
+#endif /* WITH_WSREP */
return true;
}
/*
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 8d59db84b7f..c6ee9532919 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -407,14 +407,26 @@ void wsrep_ready_wait ()
static void wsrep_synced_cb(void* app_ctx)
{
WSREP_INFO("Synchronized with group, ready for connections");
+ bool signal_main= false;
if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort();
if (!wsrep_ready)
{
wsrep_ready= TRUE;
mysql_cond_signal (&COND_wsrep_ready);
+ signal_main= true;
+
}
local_status.set(WSREP_MEMBER_SYNCED);
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()
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index 050bb2073a8..f2ab8997079 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -231,7 +231,13 @@ void wsrep_sst_complete (const wsrep_uuid_t* sst_uuid,
}
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);
}
@@ -1049,7 +1055,10 @@ void wsrep_SE_init_grab()
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);
}