• Jon Olav Hauglid's avatar
    Backport of revno: 3702 · cf1110cd
    Jon Olav Hauglid authored
    Bug #48248 assert in MDL_ticket::upgrade_shared_lock_to_exclusive
    
    The assert would happen if REPAIR TABLE was used on a table already
    locked by LOCK TABLES READ. REPAIR mistakenly tried to upgrade the
    read-lock to exclusive, thereby triggering the assert.
    
    The cause of the problem was that REPAIR TABLE ignored errors 
    from opening and locking tables. This is by design, as REPAIR
    can be used to broken tables that cannot be opened. However,
    repair also ignored logical errors such as the inability to
    exclusivly lock a table due to conflicting LOCK TABLES.
    
    This patch fixes the problem by not ignoring errors from
    opening and locking tables if inside LOCK TABLES mode.
    In LOCK TABLES we already know that the table can be opened,
    so that the failure to open must be a logical error.
    
    Test added to repair.test.
    cf1110cd
lock.result 10.6 KB