• Ajo Robert's avatar
    Bug #18075170 SQL NODE RESTART REQUIRED TO · 515b2203
    Ajo Robert authored
    AVOID DEADLOCK AFTER RESTORE
    
    Analysis
    --------
    Accessing the restored NDB table in an active multi-statement
    transaction was resulting in deadlock found error.
    
    MySQL Server needs to discover metadata of NDB table from
    data nodes after table is restored from backup. Metadata
    discovery happens on the first access to restored table.
    Current code mandates this statement to be the first one
    in the transaction. This is because discover needs exclusive
    metadata lock on the table. Lock upgrade at this point can
    lead to MDL deadlock and the code was written at the time
    when MDL deadlock detector was not present. In case when
    discovery attempted in the statement other than the first
    one in transaction ER_LOCK_DEADLOCK error is reported
    pessimistically.
    
    Fix:
    ---
    Removed the constraint as any potential deadlock will be
    handled by deadlock detector. Also changed code in discover
    to keep metadata locks of active transaction.
    
    Same issue was present in table auto repair scenario. Same
    fix is added in repair path also.
    515b2203
myisam_recover.result 4.42 KB