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.
Showing
Please register or sign in to comment