• unknown's avatar
    Bug#55375 Transaction bigger than max_binlog_cache_size crashes slave · 10812c07
    unknown authored
    When slave executes a transaction bigger than slave's max_binlog_cache_size,
    slave will crash. It is caused by the assert that server should only roll back
    the statement but not the whole transaction if the error ER_TRANS_CACHE_FULL 
    happens. But slave sql thread always rollbacks the whole transaction when
    an error happens.
                
    Ather this patch, we always clear any error set in sql thread(it is different
    from the error in 'SHOW SLAVE STATUS') and it is cleared before rolling back
    the transaction.
    
    
    mysql-test/suite/rpl/r/rpl_binlog_max_cache_size.result:
      SET binlog_cache_size and max_binlog_cache_size for all test cases.
      Add test case for bug#55375.
    mysql-test/suite/rpl/t/rpl_binlog_max_cache_size-master.opt:
      binlog_cache_size and max_binlog_cache_size can be set in the client connection.
      so remove this option file.
    mysql-test/suite/rpl/t/rpl_binlog_max_cache_size.test:
      SET binlog_cache_size and max_binlog_cache_size for all test cases.
      Add test case for bug#55375.
    sql/log_event.cc:
      Some functions don't return the error code, so it is a wrong error code.
      The error should always be set into thd->main_da. So we use 
      slave_rows_error_report to report the right error.
    sql/slave.cc:
      exec_relay_log_event() need call cleanup_context() to clear context. 
      clearup_context() will call end_trans().
              
      Clear thd's error before cleanup_context. It avoid to trigger the assert
      which cause this bug.
    10812c07
slave.cc 152 KB