Skip to content
  • Venkatesh Duggirala's avatar
    0950bcb2
    Bug #17026898 PREVIOUS GTID EVENT IS NOT WRITTEN WHEN BINLOG IS ROTATED VIA · 0950bcb2
    Venkatesh Duggirala authored
    SIGHUP
    
    Problem: When Binlog is rotated via SIGHUP signal, the newly generated binlog
    does not contain previous gtid event which is very important for processing
    that binlog's gtid events later.
    
    If there are any transactions written to this binlog then on next restart,
    while server is processing available binary logs, it was failing with
    following error:
    "The first global transaction identifier was read, but no other information
    regarding identifiers existing on the previous log files was found."
    and the server refuses to start.
    
    Or If the new GTID transactions which were written to this new binlog
    are replicated, Slave gets confused after seeing a GTID event without 
    a previous_gtid_event and enters into "Fatal 1236" error.
    
    Analysis: SIGHUP siganl causes the server to reload the grant tables
    and to flush tables, logs, the thread cache, and the host cache.
    As part of flush logs, server rotates binary log as well.
    
    When server receives SIGHUP signal, it calls reload_acl_and_cache and
    which eventually executes the following code to write PREVIOUS_GTID_EVENT.
    if (current_thd && gtid_mode > 0)
    {
    /* write previous gtid event */
    }
    
    And current_thd is NULL when server reaches this code through signal handler.
    Hence the newly generated binary log is not containing previous gtid event
    which resulted in reported issue at the time of restart.
    
    Fix: If reload_acl_and_cache() is called from SIGHUP handler, then
    allocate temporary THD before execution of binary log rotation function.
    The same above problem can be seen with relay log as well. Hence this
    temporary THD will be allocated even before relay log rotation function.
    And delete the THD object after finishing the task.
    0950bcb2
    Bug #17026898 PREVIOUS GTID EVENT IS NOT WRITTEN WHEN BINLOG IS ROTATED VIA
    Venkatesh Duggirala authored
    SIGHUP
    
    Problem: When Binlog is rotated via SIGHUP signal, the newly generated binlog
    does not contain previous gtid event which is very important for processing
    that binlog's gtid events later.
    
    If there are any transactions written to this binlog then on next restart,
    while server is processing available binary logs, it was failing with
    following error:
    "The first global transaction identifier was read, but no other information
    regarding identifiers existing on the previous log files was found."
    and the server refuses to start.
    
    Or If the new GTID transactions which were written to this new binlog
    are replicated, Slave gets confused after seeing a GTID event without 
    a previous_gtid_event and enters into "Fatal 1236" error.
    
    Analysis: SIGHUP siganl causes the server to reload the grant tables
    and to flush tables, logs, the thread cache, and the host cache.
    As part of flush logs, server rotates binary log as well.
    
    When server receives SIGHUP signal, it calls reload_acl_and_cache and
    which eventually executes the following code to write PREVIOUS_GTID_EVENT.
    if (current_thd && gtid_mode > 0)
    {
    /* write previous gtid event */
    }
    
    And current_thd is NULL when server reaches this code through signal handler.
    Hence the newly generated binary log is not containing previous gtid event
    which resulted in reported issue at the time of restart.
    
    Fix: If reload_acl_and_cache() is called from SIGHUP handler, then
    allocate temporary THD before execution of binary log rotation function.
    The same above problem can be seen with relay log as well. Hence this
    temporary THD will be allocated even before relay log rotation function.
    And delete the THD object after finishing the task.
Loading