• Mattias Jonsson's avatar
    Bug#54747: Deadlock between REORGANIZE PARTITION and SELECT is not detected · 8df0bf13
    Mattias Jonsson authored
    The ALTER PARTITION and SELECT seemed to be deadlocked
    when having innodb_thread_concurrency = 1.
    
    Problem was that there was unreleased latches
    in the ALTER PARTITION thread which was needed
    by the SELECT thread to be able to continue.
    
    Solution was to release the latches by commit 
    before requesting upgrade to exclusive MDL lock.
    
    Updated according to reviewers comments (3).
    
    mysql-test/r/partition_innodb.result:
      updated test result
    mysql-test/t/partition_innodb.test:
      added test
    sql/sql_partition.cc:
      Moved implicit commit into mysql_change_partition
      so that if latches are taken, they are always released
      before waiting on exclusive lock.
    sql/sql_table.cc:
      refactored the code to prepare and commit
      around copy_data_between_tables, to be able
      to reuse it in mysql_change_partitions
    sql/sql_table.h:
      exporting mysql_trans_prepare/commit_alter_copy_data
    8df0bf13
partition_innodb.result 17.7 KB