• Sergey Vojtovich's avatar
    Acquire global read lock (MDL_BACKUP_STMT) after share is acquired · f1867505
    Sergey Vojtovich authored
    Part of MDEV-5336 Implement LOCK FOR BACKUP
    
    FLUSH TABLE table_names have changed slighty as we are now opening
    tables before taking the MDL lock. The difference is that FLUSH TABLE
    table_name will now be blocked by a table that is waiting for FTWRL.
    There should not be any new deadlocks as part of this change.
    
    The end result is still better in most cases as FTWRL is now only
    waiting for write statements to end, not for read only statements and
    it's not flushing tables in use from the table cache.
    
    Share will be needed to be able to determine if table supports online
    backup. Appropriate metadata lock type in BACKUP namespace will be
    acquired basing on this information.
    
    Also made pending global read lock request to be preferred victim of MDL
    deadlock detector. This allows us to hide some non-fatal deadlocks and
    make FTWRL less likely to break concurrent queries.
    f1867505
lock_multi.result 14.1 KB