summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-03-28 12:27:06 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-03-28 12:39:50 +0200
commitd0116e10a5da52503a89a413e481996ce3f65e63 (patch)
treee67bbdfa81ee11b205610c3b038e864f3206a0a6 /sql
parent81d71ee6b21870772c336bff15b71904914f146a (diff)
downloadmariadb-git-d0116e10a5da52503a89a413e481996ce3f65e63.tar.gz
Revert MDEV-18464 and MDEV-12009
This reverts commit 21b2fada7ab7f35c898c02d2f918461409cc9c8e and commit 81d71ee6b21870772c336bff15b71904914f146a. The MDEV-18464 change introduces a few data race issues. Contrary to the documentation, the field trx_t::victim is not always being protected by lock_sys_t::mutex and trx_t::mutex. Most importantly, it seems that KILL QUERY could wrongly avoid acquiring both mutexes when invoking lock_trx_handle_wait_low(), in case another thread had already set trx->victim=true. We also revert MDEV-12009, because it should depend on the MDEV-18464 fix being present.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc14
-rw-r--r--sql/sql_plugin_services.ic3
-rw-r--r--sql/wsrep_dummy.cc3
-rw-r--r--sql/wsrep_mysqld.cc1
-rw-r--r--sql/wsrep_thd.cc9
-rw-r--r--sql/wsrep_thd.h2
6 files changed, 5 insertions, 27 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 920f7ac0329..1f060305d4f 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -8292,19 +8292,11 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
It's ok to also kill DELAYED threads with KILL_CONNECTION instead of
KILL_SYSTEM_THREAD; The difference is that KILL_CONNECTION may be
faster and do a harder kill than KILL_SYSTEM_THREAD;
-
- Note that if thread is wsrep Brute Force or applier thread we
- allow killing it only when we're SUPER.
*/
- if ((thd->security_ctx->master_access & SUPER_ACL) ||
- (thd->security_ctx->user_matches(tmp->security_ctx)
-#ifdef WITH_WSREP
- &&
- !tmp->wsrep_applier &&
- !wsrep_thd_is_BF(tmp, false)
-#endif
- ))
+ if (((thd->security_ctx->master_access & SUPER_ACL) ||
+ thd->security_ctx->user_matches(tmp->security_ctx)) &&
+ !wsrep_thd_is_BF(tmp, false))
{
tmp->awake(kill_signal);
error=0;
diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic
index d70c76701fd..427d8937c57 100644
--- a/sql/sql_plugin_services.ic
+++ b/sql/sql_plugin_services.ic
@@ -181,8 +181,7 @@ static struct wsrep_service_st wsrep_handler = {
wsrep_trx_is_aborting,
wsrep_trx_order_before,
wsrep_unlock_rollback,
- wsrep_set_data_home_dir,
- wsrep_thd_is_applier,
+ wsrep_set_data_home_dir
};
static struct thd_specifics_service_st thd_specifics_handler=
diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc
index e2a4dcf3bad..795e2d19252 100644
--- a/sql/wsrep_dummy.cc
+++ b/sql/wsrep_dummy.cc
@@ -20,9 +20,6 @@
my_bool wsrep_thd_is_BF(THD *, my_bool)
{ return 0; }
-my_bool wsrep_thd_is_applier(THD *)
-{ return 0; }
-
int wsrep_trx_order_before(THD *, THD *)
{ return 0; }
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 82415691b3f..ee8509e3fa2 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -2470,6 +2470,7 @@ extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode)
thd->wsrep_exec_mode= mode;
}
+
extern "C" void wsrep_thd_set_query_state(
THD *thd, enum wsrep_query_state state)
{
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 91f0e1e8d8a..551e710cfeb 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -596,15 +596,6 @@ my_bool wsrep_thd_is_BF(THD *thd, my_bool sync)
return status;
}
-my_bool wsrep_thd_is_applier(THD *thd)
-{
- my_bool ret = FALSE;
- if (thd) {
- ret = thd->wsrep_applier;
- }
- return ret;
-}
-
extern "C"
my_bool wsrep_thd_is_BF_or_commit(void *thd_ptr, my_bool sync)
{
diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h
index f5fcb50280c..5900668f3fb 100644
--- a/sql/wsrep_thd.h
+++ b/sql/wsrep_thd.h
@@ -37,7 +37,6 @@ int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr,
*/
extern void wsrep_thd_set_PA_safe(void *thd_ptr, my_bool safe);
extern my_bool wsrep_thd_is_BF(THD *thd, my_bool sync);
-extern my_bool wsrep_thd_is_applier(THD *thd);
extern my_bool wsrep_thd_is_wsrep(void *thd_ptr);
enum wsrep_conflict_state wsrep_thd_conflict_state(void *thd_ptr, my_bool sync);
@@ -48,7 +47,6 @@ extern "C" int wsrep_thd_in_locking_session(void *thd_ptr);
#else /* WITH_WSREP */
#define wsrep_thd_is_BF(T, S) (0)
-#define wsrep_thd_is_applier(T) (0)
#define wsrep_abort_thd(X,Y,Z) do { } while(0)
#define wsrep_create_appliers(T) do { } while(0)