• unknown's avatar
    Bug#46640: output from mysqlbinlog command in 5.1 breaks replication · f9c67302
    unknown authored
          
    The BINLOG statement was sharing too much code with the slave SQL thread, introduced with
    the patch for Bug#32407. This caused statements to be logged with the wrong server_id, the
    id stored inside the events of the BINLOG statement rather than the id of the running 
    server.
          
    Fix by rearranging code a bit so that only relevant parts of the code are executed by
    the BINLOG statement, and the server_id of the server executing the statements will 
    not be overrided by the server_id stored in the 'format description BINLOG statement'.
    
    mysql-test/extra/binlog_tests/binlog.test:
      Added test to verify if the server_id stored in the 'format 
      description BINLOG statement' will override the server_id
      of the server executing the statements.
    mysql-test/suite/binlog/r/binlog_row_binlog.result:
      Test result for bug#46640
    mysql-test/suite/binlog/r/binlog_stm_binlog.result:
      Test result for bug#46640
    sql/log_event.cc:
      Moved rows_event_stmt_clean() call from update_pos() to apply_event(). This in any case
      makes more sense, and is needed as update_pos() is no longer called when executing
      BINLOG statements.
      
      Moved setting of rli->relay_log.description_event_for_exec from 
      Format_description_log_event::do_update_pos() to 
      Format_description_log_event::do_apply_event()
    sql/log_event_old.cc:
      Moved rows_event_stmt_clean() call from update_pos() to apply_event(). This in any case
      makes more sense, and is needed as update_pos() is no longer called when executing
      BINLOG statements.
    sql/slave.cc:
      The skip flag is no longer needed, as the code path for BINLOG statement has been 
      cleaned up.
    sql/sql_binlog.cc:
      Don't invoke the update_pos() code path for the BINLOG statement, as it contains code 
      that is redundant and/or harmful (especially setting thd->server_id).
    f9c67302
log_event_old.cc 93.7 KB