diff options
author | He Zhenxing <zhenxing.he@sun.com> | 2009-03-27 13:19:50 +0800 |
---|---|---|
committer | He Zhenxing <zhenxing.he@sun.com> | 2009-03-27 13:19:50 +0800 |
commit | 95301268221bfcf72baaa9f34f234ff6231235c8 (patch) | |
tree | c64191bf0f499c4e0d6b020460f019c04f7dc2e8 /sql/log.cc | |
parent | 75ab3274c8f36aa0be49d03e3616e5c557890b2a (diff) | |
download | mariadb-git-95301268221bfcf72baaa9f34f234ff6231235c8.tar.gz |
BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053
When the thread executing a DDL was killed after finished its
execution but before writing the binlog event, the error code in
the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
ER_QUERY_INTERRUPTED.
This patch fixed the problem by ignoring the kill status when
constructing the event for DDL statements.
This patch also included the following changes in order to
provide the test case.
1) modified mysqltest to support variable for connection command
2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
run mysql client against the slave mysqld.
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sql/log.cc b/sql/log.cc index d979dd101e0..b16303ee232 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -158,7 +158,8 @@ static int binlog_commit(THD *thd, bool all) */ if (all || !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) { - Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE); + Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), + TRUE, FALSE, THD::KILLED_NO_VALUE); qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE) DBUG_RETURN(binlog_end_trans(thd, trans_log, &qev)); } @@ -202,7 +203,8 @@ static int binlog_rollback(THD *thd, bool all) */ if (unlikely(thd->transaction.all.modified_non_trans_table)) { - Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE); + Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), + TRUE, FALSE, THD::KILLED_NO_VALUE); qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE) error= binlog_end_trans(thd, trans_log, &qev); } @@ -240,7 +242,8 @@ static int binlog_savepoint_set(THD *thd, void *sv) *(my_off_t *)sv= my_b_tell(trans_log); /* Write it to the binary log */ - Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE, FALSE); + Query_log_event qinfo(thd, thd->query, thd->query_length, + TRUE, FALSE, THD::KILLED_NO_VALUE); DBUG_RETURN(mysql_bin_log.write(&qinfo)); } @@ -257,7 +260,8 @@ static int binlog_savepoint_rollback(THD *thd, void *sv) */ if (unlikely(thd->transaction.all.modified_non_trans_table)) { - Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE, FALSE); + Query_log_event qinfo(thd, thd->query, thd->query_length, + TRUE, FALSE, THD::KILLED_NO_VALUE); DBUG_RETURN(mysql_bin_log.write(&qinfo)); } reinit_io_cache(trans_log, WRITE_CACHE, *(my_off_t *)sv, 0, 0); @@ -2089,7 +2093,8 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) transaction is either a BEGIN..COMMIT block or a single statement in autocommit mode. */ - Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE); + Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), + TRUE, FALSE, THD::KILLED_NO_VALUE); /* Imagine this is rollback due to net timeout, after all statements of the transaction succeeded. Then we want a |