• Mattias Jonsson's avatar
    Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with · 5196beed
    Mattias Jonsson authored
    concurrent I_S query
    
    There were two problem:
    1) MYSQL_LOCK_IGNORE_FLUSH also ignored name locks
    2) there was a race between abort_and_upgrade_locks and
       alter_close_tables
       (i.e. remove_table_from_cache and
        close_data_files_and_morph_locks)
    
    Which allowed the table to be opened with MYSQL_LOCK_IGNORE_FLUSH flag
    resulting in renaming a partition that was already in use,
    which could cause the table to be unusable.
    
    Solution was to not allow IGNORE_FLUSH to skip waiting for
    a named locked table.
    
    And to not release the LOCK_open mutex between the
    calls to remove_table_from_cache and
    close_data_files_and_morph_locks by merging the functions
    abort_and_upgrade_locks and alter_close_tables.
    
    mysql-test/suite/parts/r/partition_debug_sync_innodb.result:
      Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
      concurrent I_S query
      
      Added test result
    mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt:
      Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
      concurrent I_S query
      
      Added test option
    mysql-test/suite/parts/t/partition_debug_sync_innodb.test:
      Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
      concurrent I_S query
      
      Added test file
    sql/authors.h:
      Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
      concurrent I_S query
      
      Time to be acknowledged :)
    sql/ha_partition.cc:
      Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
      concurrent I_S query
      
      Added DEBUG_SYNC for deterministic testing
    sql/mysql_priv.h:
      Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
      concurrent I_S query
      
      Renamed function since merging alter_close_tables into
      abort_and_upgrade_lock.
    sql/sql_base.cc:
      Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
      concurrent I_S query
      
      Changed MYSQL_LOCK_IGNORE_FLUSH to not ignore name locks
      (open_placeholder).
      
      Merged alter_close_tables into abort_and_upgrade_locks
      (and added _and_close_table to the name)
      to not release LOCK_open between remove_table_from_cache
      and close_data_files_and_morph_locks.
      
      Added DEBUG_SYNC for deterministic testing.
    sql/sql_partition.cc:
      Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
      concurrent I_S query
      
      Removed alter_close_tables, (merged it into
      abort_and_upgrad_lock) so that LOCK_open never is released
      between remove_table_from_cache and
      close_data_files_and_morph_locks.
    sql/sql_show.cc:
      Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
      concurrent I_S query
      
      Added DEBUG_SYNC for deterministic testing
    5196beed
partition_debug_sync_innodb.test 1.5 KB