• Jon Olav Hauglid's avatar
    Bug #54282 Crash in MDL_context::upgrade_shared_lock_to_exclusive · b5a038a5
    Jon Olav Hauglid authored
    This crash happened if a table was listed twice in a DROP TABLE statement,
    and the statement was executed while in LOCK TABLES mode. Since the two
    elements of table list were identical, they were assigned the same TABLE object. 
    During processing of the first table element, the TABLE instance was destroyed
    and the second table list element was left with a dangling reference.
    When this reference was later accessed, the server crashed.
    
    Listing the same table twice in DROP TABLES should give an ER_NONUNIQ_TABLE
    error. However, this did not happen as the check for unique table names was 
    skipped due to the lock type for table list elements being set to TL_IGNORE.
    Previously TL_UNLOCK was used and the unique check was performed.
    
    This bug was a regression introduced by a pre-requisite patch for
    Bug#51263 "Deadlock between transactional SELECT and ALTER TABLE ...
    REBUILD PARTITION". The regression only existed in an internal team
    tree and never in any released code.
    
    This patch reverts DROP TABLE (and DROP VIEW) to the old behavior of
    using TL_UNLOCK locks. Test case added to drop.test.
    b5a038a5
drop.test 7.06 KB