• unknown's avatar
    Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock · 548416b3
    unknown authored
    The log tables are by nature PERFORMANCE_SCHEMA tables,
    which should not be affected by SET GLOBAL READ_ONLY or FLUSH TABLES
    WITH READ LOCK.
    
    The implementation of FLUSH TABLES WITH READ LOCK already ignored log tables.
    Now with this patch, the implementation of LOCK TABLE also ignore a
    global read lock for log tables, which was the missing symmetry.
    
    
    mysql-test/r/flush.result:
      Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
        - test result.
    mysql-test/t/flush.test:
      Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
        - test case.
    sql/lock.cc:
      Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
        - logger.is_privileged_thread() used.
    sql/log.h:
      Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
        - LOGGER::is_privileged_thread() introduced that returns TRUE if a given thread 
          is either a general_log or a slow_log or a privileged thread.
    sql/sql_base.cc:
      Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
        - pass MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK to the mysql_lock_tables() in case of 
          call from a logger in order not to honor the GLOBAL READ LOCK 
          and to avoid possible deadlocks.
    548416b3
flush.result 1.95 KB