diff options
author | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-02-06 10:44:03 +0100 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-02-06 10:44:03 +0100 |
commit | 95c2386148174b0c67b68778de0039955c73507f (patch) | |
tree | 12223398181fe9eecdcd0b9bf0e3175a582d0ec7 /sql/mdl.cc | |
parent | ba678eef7de4a8c5fbea07928b87fef84765f22b (diff) | |
download | mariadb-git-95c2386148174b0c67b68778de0039955c73507f.tar.gz |
Bug #50912 Assertion `ticket->m_type >= mdl_request->type'
failed on HANDLER + I_S
This assert was triggered when an I_S query tried to acquire a
metadata lock on a table which was already locked by a HANDLER
statement in the same connection.
First the HANDLER took a MDL_SHARED lock. Afterwards, the I_S query
requested a MDL_SHARED_HIGH_PRIO lock. The existing MDL_SHARED ticket
is found in find_ticket() since it satisfies
ticket->has_stronger_or_equal_type(mdl_request->type) as MDL_SHARED
and MDL_SHARED_HIGH_PRIO have equal strengths, just different priority.
However, two asserts later check lock type strengths using relational
operators (>= and <=) rather than MDL_ticket::has_stronger_or_equal_type().
These asserts are triggered since MDL_SHARED >= MDL_SHARED_HIGH_PRIORITY
is false (mapped to 1 and 2 respectively).
This patch updates the asserts to use MDL_ticket::has_stronger_or_equal_type()
rather than relational operators to check lock type strength.
Test case added to include/handler.inc.
Diffstat (limited to 'sql/mdl.cc')
-rw-r--r-- | sql/mdl.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/mdl.cc b/sql/mdl.cc index 2470ce5b4b7..54931f89e40 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -1261,7 +1261,7 @@ MDL_context::try_acquire_lock(MDL_request *mdl_request) if ((ticket= find_ticket(mdl_request, &is_transactional))) { DBUG_ASSERT(ticket->m_lock); - DBUG_ASSERT(ticket->m_type >= mdl_request->type); + DBUG_ASSERT(ticket->has_stronger_or_equal_type(mdl_request->type)); /* If the request is for a transactional lock, and we found a transactional lock, just reuse the found ticket. @@ -1349,7 +1349,7 @@ MDL_context::clone_ticket(MDL_request *mdl_request) return TRUE; /* clone() is not supposed to be used to get a stronger lock. */ - DBUG_ASSERT(ticket->m_type <= mdl_request->ticket->m_type); + DBUG_ASSERT(mdl_request->ticket->has_stronger_or_equal_type(ticket->m_type)); ticket->m_lock= mdl_request->ticket->m_lock; mdl_request->ticket= ticket; |