• Andrei Elkin's avatar
    Bug #47142 "slave start until" stops 1 event too late in 4.1 to 5.0 replication · cfa7e83d
    Andrei Elkin authored
    When replicating from 4.1 master to 5.0 slave START SLAVE UNTIL can stop too late.
    The necessary in calculating of the beginning of an event the event's length
    did not correspond to the master's genuine information at the event's execution time.
    That piece of info was changed at the event's relay-logging due to binlog_version<4 event
    conversion by IO thread.
    
    Fixed with storing the master genuine Query_log_event size into a new status
    variable at relay-logging of the event. The stored info is extacted at the event
    execution and participate further to caclulate the correct start position of the event
    in the until-pos stopping routine.
    The new status variable's algorithm will be only active when the event comes
    from the master of version < 5.0 (binlog_version < 4).
    
    
    mysql-test/r/rpl_until.result:
      results changed.
    mysql-test/std_data/bug47142_master-bin.000001:
      a binlog from 4.1 master to replace one of the running 5.x master is added as 
      part of Bug #47142 regression test.
    mysql-test/t/rpl_until.test:
      Regression test for Bug #47142 is added.
    sql/log_event.cc:
      Storing and extracting the master's genuine size of the event from the status
      var of the event packet header.
      The binlog_version<4 query-log-event is 
      a. converted into the modern binlog_version==4 to store the original size of the event
         into a new status var; the converted representation goes into the relay log.
      b. the converted event is read out and the stored size is engaged in the start pos calculation.
      
      The new status is active only for events that IO thread instantiates for the sake of the conversion.
    sql/log_event.h:
      Incrementing the max szie of MAX_SIZE_LOG_EVENT_STATUS because of the new status var;
      Defining the new status variable to hold the master's genuine event size;
      Augmenting the Query_log_event with a new member to hold a value to store/extact from the status
      var of the event packet header.
    cfa7e83d
rpl_until.test 3.72 KB