• Sujatha Sivakumar's avatar
    Bug#20685029: SLAVE IO THREAD SHOULD STOP WHEN DISK IS · 83611517
    Sujatha Sivakumar authored
    FULL
    Bug#21753696: MAKE SHOW SLAVE STATUS NON BLOCKING IF IO
    THREAD WAITS FOR DISK SPACE
    
    Problem:
    ========
    Currently SHOW SLAVE STATUS blocks if IO thread waits for
    disk space. This makes automation tools verifying
    server health block on taking relevant action. Finally this
    will create SHOW SLAVE STATUS piles.
    
    Analysis:
    =========
    SHOW SLAVE STATUS hangs on mi->data_lock if relay log write
    is waiting for free disk space while holding mi->data_lock.
    mi->data_lock is needed to protect the format description
    event (mi->format_description_event) which is accessed by
    the clients running FLUSH LOGS and slave IO thread. Note
    relay log writes don't need to be protected by
    mi->data_lock, LOCK_log is used to protect relay log between
    IO and SQL thread (see MYSQL_BIN_LOG::append_event). The
    code takes mi->data_lock to protect
    mi->format_description_event during relay log rotate which
    might get triggered right after relay log write.
    
    Fix:
    ====
    Release the data_lock just for the duration of writing into
    relay log.
    
    Made change to ensure the following lock order is maintained
    to avoid deadlocks.
    
    data_lock, LOCK_log
    
    data_lock is held during relay log rotations to protect
    the description event.
    83611517
start_slave_sql.inc 799 Bytes