• Thirunarayanan Balathandayuthapani's avatar
    Bug #25357789 INNODB: LATCH ORDER VIOLATION DURING TRUNCATE TABLE IF INNODB_SYNC_DEBUG ENABLED · 9d57468d
    Thirunarayanan Balathandayuthapani authored
    Analysis:
    ========
    
    (1) During TRUNCATE of file_per_table tablespace, dict_operation_lock is
    released before eviction of dirty pages of a tablespace from the buffer
    pool. After eviction, we try to re-acquire
    dict_operation_lock (higher level latch) but we already hold lower
    level latch (index->lock). This causes latch order violation
    
    (2) Deadlock issue is present if child table is being truncated and it
    holds index lock. At the same time, cascade dml happens and it took
    dict_operation_lock and waiting for index lock.
    
    Fix:
    ====
    1) Release the indexes lock before releasing the dict operation lock.
    
    2) Ignore the cascading dml operation on the parent table, for the
    cascading foreign key, if the child table is truncated or if it is
    in the process of being truncated.
    Reviewed-by: default avatarJimmy Yang <jimmy.yang@oracle.com>
    Reviewed-by: default avatarKevin Lewis <kevin.lewis@oracle.com>
    RB: 16122
    9d57468d
fil0fil.h 53.7 KB