Skip to content
  • Venkatesh Duggirala's avatar
    4ded5690
    Bug#18622657 SECONDS_BEHIND_MASTER DISTORTED BECAUSE OF · 4ded5690
    Venkatesh Duggirala authored
    PREVIOUS_GTID EVENT
    
    Problem: Previous gtid log event in relay log should not be contributed to
    seconds behind master calculation.
    
    Analysis: A log event contains a timestamp in it's header which represents
    the time at which it got generated on Master. In relaylog, we have events which got
    transferred from Master and also contains which were generated on Slave, which
    we call it as " a relay log event" for eg: when relaylog is rotated,
    Slave generates and writes Previous_gtid_log_event in to the relay log.
    These events (which got generated on Slave) contains the
    timestamp of thread's starting time. When we are calculating Second Behind
    Master(SBM), the events which are generated on Slave should be ignored and should
    not contribute to SBM calculation. We already have a logic in the server
    if (!ev->is_relay_log_event())
    {
      last_master_timestamp=
    }
    
    But the previous gtid log events generated on Slave are not marked as "relay log events"
    hence last_master_timestamp is getting set with thread's start time and SBM
    will have wrong value.
    
    And also in some situations, we generate Rotate log events
    on slave to maintain the SQL positions in sync with Master
    these log events are generated with server_id 0.
    These events also should not contribute to SBM calculation.
    
    Fix: Mark previous_gtid_log_event as relay log event.
    And don't set last_master_timestamp when server_id= 0.
    4ded5690
    Bug#18622657 SECONDS_BEHIND_MASTER DISTORTED BECAUSE OF
    Venkatesh Duggirala authored
    PREVIOUS_GTID EVENT
    
    Problem: Previous gtid log event in relay log should not be contributed to
    seconds behind master calculation.
    
    Analysis: A log event contains a timestamp in it's header which represents
    the time at which it got generated on Master. In relaylog, we have events which got
    transferred from Master and also contains which were generated on Slave, which
    we call it as " a relay log event" for eg: when relaylog is rotated,
    Slave generates and writes Previous_gtid_log_event in to the relay log.
    These events (which got generated on Slave) contains the
    timestamp of thread's starting time. When we are calculating Second Behind
    Master(SBM), the events which are generated on Slave should be ignored and should
    not contribute to SBM calculation. We already have a logic in the server
    if (!ev->is_relay_log_event())
    {
      last_master_timestamp=
    }
    
    But the previous gtid log events generated on Slave are not marked as "relay log events"
    hence last_master_timestamp is getting set with thread's start time and SBM
    will have wrong value.
    
    And also in some situations, we generate Rotate log events
    on slave to maintain the SQL positions in sync with Master
    these log events are generated with server_id 0.
    These events also should not contribute to SBM calculation.
    
    Fix: Mark previous_gtid_log_event as relay log event.
    And don't set last_master_timestamp when server_id= 0.
Loading