1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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.
This commit is contained in:
Jon Olav Hauglid
2010-02-06 10:44:03 +01:00
parent ba678eef7d
commit 95c2386148
4 changed files with 48 additions and 2 deletions

View File

@ -1522,3 +1522,23 @@ HANDLER t2 READ FIRST;
HANDLER t2 CLOSE;
DROP TABLE t1, t2;
--echo #
--echo # Bug#50912 Assertion `ticket->m_type >= mdl_request->type'
--echo # failed on HANDLER + I_S
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (id INT);
HANDLER t1 OPEN;
# This used to trigger the assert.
SELECT table_name, table_comment FROM information_schema.tables
WHERE table_schema= 'test' AND table_name= 't1';
HANDLER t1 CLOSE;
DROP TABLE t1;