• unknown's avatar
    BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if · fea2a5d8
    unknown authored
                log-slave-updates and circul repl
    
    Slave SQL thread may execute one extra event when there are events
    skipped by slave I/O thread (e.g. originated by the same server).
    Whereas it was requested not to do so by the UNTIL condition.
    
    This happens because we compare with the end position of previously
    executed event. This is fine when there are no skipped by slave I/O
    thread events, as end position of previous event equals to start
    position of to be executed event. Otherwise this position equals to
    start position of skipped event.
    
    This is fixed by:
    - reading the event to be executed before checking if the until condition
      is satisfied.
    - comparing the start position of the event to be executed. Since we do
      not have the start position available, we compute it by subtracting
      event length from end position (which is available).
    - if there are no events on the event queue at the slave sql starting
      time, that meet until condition, we stop immediately, as in this
      case we do not want to wait for next event.
    
    
    mysql-test/r/rpl_dual_pos_advance.result:
      A test case for BUG#13861.
    mysql-test/t/rpl_dual_pos_advance.test:
      A test case for BUG#13861.
    sql/log_event.cc:
      Store length of event. This is needed for further calculation of
      the beginning of event.
    sql/slave.cc:
      Slave SQL thread may execute one extra event when there are events
      skipped by slave I/O thread (e.g. originated by the same server).
      Whereas it was requested not to do so by the UNTIL condition.
      
      This happens because we compare with the end position of previously
      executed event. This is fine when there are no skipped by slave I/O
      thread events, as end position of previous event equals to start
      position of to be executed event. Otherwise this position equals to
      start position of skipped event.
      
      This is fixed by:
      - reading the event to be executed before checking if the until condition
        is satisfied.
      - comparing the start position of the event to be executed. Since we do
        not have the start position available, we compute it by subtracting
        event length from end position (which is available).
      - if there are no events on the event queue at the slave sql starting
        time, that meet until condition, we stop immediately, as in this
        case we do not want to wait for next event.
    sql/slave.h:
      Added master_log_pos parametr to is_until_satisfied().
    mysql-test/t/rpl_dual_pos_advance-slave.opt:
      New BitKeeper file ``mysql-test/t/rpl_dual_pos_advance-slave.opt''
    fea2a5d8
rpl_dual_pos_advance.result 1.68 KB