Skip to content

Commit

Permalink
Cleanup: MDL_context::wsrep_get_thd() is no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Nirbhay Choubey committed Sep 1, 2016
1 parent 16702ec commit 616271b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
20 changes: 10 additions & 10 deletions sql/mdl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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;
}
}
Expand Down
1 change: 0 additions & 1 deletion sql/mdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,6 @@ class MDL_context

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(); }
Expand Down
4 changes: 2 additions & 2 deletions sql/wsrep_mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 616271b

Please sign in to comment.