From 616271b7c9f69596df740a8fec5a4f39b959d064 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Thu, 1 Sep 2016 12:53:44 -0400 Subject: [PATCH] Cleanup: MDL_context::wsrep_get_thd() is no longer needed --- sql/mdl.cc | 20 ++++++++++---------- sql/mdl.h | 1 - sql/wsrep_mysqld.cc | 4 ++-- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/sql/mdl.cc b/sql/mdl.cc index 1e7502aebd8..0f1c961aa29 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -1533,7 +1533,7 @@ void MDL_lock::Ticket_list::add_ticket(MDL_ticket *ticket) DBUG_ASSERT(ticket->get_lock()); #ifdef WITH_WSREP if ((this == &(ticket->get_lock()->m_waiting)) && - wsrep_thd_is_BF((void *)(ticket->get_ctx()->wsrep_get_thd()), false)) + wsrep_thd_is_BF((void *)(ticket->get_ctx()->get_thd()), false)) { Ticket_iterator itw(ticket->get_lock()->m_waiting); Ticket_iterator itg(ticket->get_lock()->m_granted); @@ -1544,11 +1544,11 @@ void MDL_lock::Ticket_list::add_ticket(MDL_ticket *ticket) while ((waiting= itw++) && !added) { - if (!wsrep_thd_is_BF((void *)(waiting->get_ctx()->wsrep_get_thd()), true)) + if (!wsrep_thd_is_BF((void *)(waiting->get_ctx()->get_thd()), true)) { WSREP_DEBUG("MDL add_ticket inserted before: %lu %s", - wsrep_thd_thread_id(waiting->get_ctx()->wsrep_get_thd()), - wsrep_thd_query(waiting->get_ctx()->wsrep_get_thd())); + wsrep_thd_thread_id(waiting->get_ctx()->get_thd()), + wsrep_thd_query(waiting->get_ctx()->get_thd())); /* Insert the ticket before the first non-BF waiting thd. */ m_list.insert_after(prev, ticket); added= true; @@ -1949,12 +1949,12 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg, ticket->is_incompatible_when_granted(type_arg)) #ifdef WITH_WSREP { - if (wsrep_thd_is_BF((void *)(requestor_ctx->wsrep_get_thd()),false) && + if (wsrep_thd_is_BF((void *)(requestor_ctx->get_thd()),false) && key.mdl_namespace() == MDL_key::GLOBAL) { WSREP_DEBUG("global lock granted for BF: %lu %s", - wsrep_thd_thread_id(requestor_ctx->wsrep_get_thd()), - wsrep_thd_query(requestor_ctx->wsrep_get_thd())); + wsrep_thd_thread_id(requestor_ctx->get_thd()), + wsrep_thd_query(requestor_ctx->get_thd())); can_grant = true; } else if (!wsrep_grant_mdl_exception(requestor_ctx, ticket, &key)) @@ -1990,12 +1990,12 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg, #ifdef WITH_WSREP else { - if (wsrep_thd_is_BF((void *)(requestor_ctx->wsrep_get_thd()), false) && + if (wsrep_thd_is_BF((void *)(requestor_ctx->get_thd()), false) && key.mdl_namespace() == MDL_key::GLOBAL) { WSREP_DEBUG("global lock granted for BF (waiting queue): %lu %s", - wsrep_thd_thread_id(requestor_ctx->wsrep_get_thd()), - wsrep_thd_query(requestor_ctx->wsrep_get_thd())); + wsrep_thd_thread_id(requestor_ctx->get_thd()), + wsrep_thd_query(requestor_ctx->get_thd())); can_grant = true; } } diff --git a/sql/mdl.h b/sql/mdl.h index 7fc58bcfb8b..86f681c90f0 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -933,7 +933,6 @@ private: public: #ifdef WITH_WSREP - THD *wsrep_get_thd() const { return get_thd(); } bool wsrep_has_explicit_locks(); #endif /* WITH_WSREP */ THD *get_thd() const { return m_owner->get_thd(); } diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 4117d5231f4..13b72b65afe 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1520,8 +1520,8 @@ wsrep_grant_mdl_exception(MDL_context *requestor_ctx, /* Fallback to the non-wsrep behaviour */ if (!WSREP_ON) return FALSE; - THD *request_thd = requestor_ctx->wsrep_get_thd(); - THD *granted_thd = ticket->get_ctx()->wsrep_get_thd(); + THD *request_thd = requestor_ctx->get_thd(); + THD *granted_thd = ticket->get_ctx()->get_thd(); bool ret = FALSE; const char* schema= key->db_name();