Skip to content
  • Daogang.qu's avatar
    ece97f2b
    Bug#20104307 GTID_EXECUTED TABLE COMPRESSION THREAD MAY NOT WAKE UP · ece97f2b
    Daogang.qu authored
    The gtid_executed table is range compressed by a background thread,
    every N transactions, where N is specified by
    @@global.executed_gtids_compression_period. The communication between
    a committing client thread and the waiting background thread is done
    using a global variable, which indicates whether the compression
    thread should wake up or not; a mutex and condition variable, which
    the the compression hangs on, and a signal, which the committing
    thread sends for the condition variable. However, the protocol for
    signalling on condition variables is not followed. The committing
    thread does not protect the update of the global variable with the
    mutex. So when the compression thread wakes up, it is possible that
    the global variable has only been changed in a memory cache that is
    only visible to the committing thread. Then the compression thread
    will read the old value of the global variable, and think that the
    signal was only sent spuriously, and go back to sleep.
    
    To fix the potential problem, The committing thread protects the
    update of the global variable with a mutex.
    ece97f2b
    Bug#20104307 GTID_EXECUTED TABLE COMPRESSION THREAD MAY NOT WAKE UP
    Daogang.qu authored
    The gtid_executed table is range compressed by a background thread,
    every N transactions, where N is specified by
    @@global.executed_gtids_compression_period. The communication between
    a committing client thread and the waiting background thread is done
    using a global variable, which indicates whether the compression
    thread should wake up or not; a mutex and condition variable, which
    the the compression hangs on, and a signal, which the committing
    thread sends for the condition variable. However, the protocol for
    signalling on condition variables is not followed. The committing
    thread does not protect the update of the global variable with the
    mutex. So when the compression thread wakes up, it is possible that
    the global variable has only been changed in a memory cache that is
    only visible to the committing thread. Then the compression thread
    will read the old value of the global variable, and think that the
    signal was only sent spuriously, and go back to sleep.
    
    To fix the potential problem, The committing thread protects the
    update of the global variable with a mutex.
Loading