• Annamalai Gurusami's avatar
    Bug #14556349 RENAME OF COMPRESSED TABLE AND INSERT BUFFER MERGE CAUSE · 7b145111
    Annamalai Gurusami authored
    HANG
    
    Problem Statement:
    
    When the operation RENAME TABLE is about rename the tablespace of the
    table, it will stop all i/o operations on the tablespace temporarily.
    For this the fil_space_t::stop_ios member is used.
    
    Once the fil_space_t::stop_ios member is set to TRUE in the RENAME
    TABLE operation, it is expected that no new i/o operation will be done
    on the tablespace and all pending i/o operation can be completed on
    the tablespace.
    
    If the pending i/o operations initiate any new i/o operations then
    there will be deadlock.  The RENAME TABLE operation will be waiting
    for pending i/o on the tablespace to be completed, and the pending i/o
    operations will be waiting on the RENAME TABLE operation to set the
    file_space_t::stop_ios flag to be set to FALSE.
    
    But in the given scenario the pending i/o operations did not initiate
    new i/o.  But they where still unnecessarily checking the
    fil_space_t::stop_ios flag.  This resulted in deadlock.
    
    Solution:
    
    I noticed that this deadlock happens in fil_space_get_size() and
    fil_space_get_zip_size() in the i/o threads.  These functions check
    the stop_ios flag even when no i/o will be initiated.  I modified
    these functions to ensure that they check the stop_ios flag only when
    they will be initiating an i/o operation.  This solves the problem.
    
    rb://1635 (mysql-5.5)
    rb://1660 (mysql-trunk) approved by Inaam, Jimmy, and ima.
    7b145111
fil0fil.c 132 KB