summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorunknown <Li-Bing.Song@sun.com>2010-10-09 15:05:43 +0800
committerunknown <Li-Bing.Song@sun.com>2010-10-09 15:05:43 +0800
commit10812c0782da89df87843ea37f7ef3cef193e725 (patch)
treeb0b97fc1f4f43afa6177fc65fb8c517c4302df62 /sql/slave.cc
parent30f57b33233baf08741aa91f9c0209b1e77689f9 (diff)
downloadmariadb-git-10812c0782da89df87843ea37f7ef3cef193e725.tar.gz
Bug#55375 Transaction bigger than max_binlog_cache_size crashes slave
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.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index f1e0962e7e8..353d4913208 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -2343,7 +2343,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
else
{
exec_res= 0;
- end_trans(thd, ROLLBACK);
+ rli->cleanup_context(thd, 1);
/* chance for concurrent connection to get more locks */
safe_sleep(thd, min(rli->trans_retries, MAX_SLAVE_RETRY_PAUSE),
(CHECK_KILLED_FUNC)sql_slave_killed, (void*)rli);
@@ -3158,6 +3158,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
request is detected only by the present function, not by events), so we
must "proactively" clear playgrounds:
*/
+ thd->clear_error();
rli->cleanup_context(thd, 1);
/*
Some extra safety, which should not been needed (normally, event deletion