diff options
author | He Zhenxing <zhenxing.he@sun.com> | 2009-05-30 21:32:28 +0800 |
---|---|---|
committer | He Zhenxing <zhenxing.he@sun.com> | 2009-05-30 21:32:28 +0800 |
commit | abf5f8dac2a0840687dc99816cbd68fb8c515e50 (patch) | |
tree | a2efff0bf717227dce4199d6e283e4a7c112dfdd /sql/sql_insert.cc | |
parent | 88e84c1fbfe9b60eeb9c3d24745ee31cfe29c38b (diff) | |
download | mariadb-git-abf5f8dac2a0840687dc99816cbd68fb8c515e50.tar.gz |
BUG#41948 Query_log_event constructor needlessly contorted
Make the caller of Query_log_event, Execute_load_log_event
constructors and THD::binlog_query to provide the error code
instead of having the constructors to figure out the error code.
sql/log_event.cc:
Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument instead of figuring it out by itself
sql/log_event.h:
Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 6c27766ec86..e14e7216a31 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -863,6 +863,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, { if (mysql_bin_log.is_open()) { + int errcode= 0; if (error <= 0) { /* @@ -877,6 +878,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, /* todo: consider removing */ thd->clear_error(); } + else + errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); + /* bug#22725: A query which per-row-loop can not be interrupted with @@ -893,7 +897,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length, transactional_table, FALSE, - (error>0) ? thd->killed : THD::NOT_KILLED) && + errcode) && transactional_table) { error=1; @@ -2667,6 +2671,12 @@ bool Delayed_insert::handle_inserts(void) thd.variables.time_zone = row->time_zone; } + /* if the delayed insert was killed, the killed status is + ignored while binlogging */ + int errcode= 0; + if (thd.killed == THD::NOT_KILLED) + errcode= query_error_code(&thd, TRUE); + /* If the query has several rows to insert, only the first row will come here. In row-based binlogging, this means that the first row will be @@ -2677,7 +2687,7 @@ bool Delayed_insert::handle_inserts(void) */ thd.binlog_query(THD::ROW_QUERY_TYPE, row->query.str, row->query.length, - FALSE, FALSE); + FALSE, FALSE, errcode); thd.time_zone_used = backup_time_zone_used; thd.variables.time_zone = backup_time_zone; @@ -3194,11 +3204,14 @@ bool select_insert::send_eof() */ if (mysql_bin_log.is_open()) { + int errcode= 0; if (!error) thd->clear_error(); + else + errcode= query_error_code(thd, killed_status == THD::NOT_KILLED); thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length, - trans_table, FALSE, killed_status); + trans_table, FALSE, errcode); } table->file->ha_release_auto_increment(); @@ -3265,8 +3278,11 @@ void select_insert::abort() { if (thd->transaction.stmt.modified_non_trans_table) { if (mysql_bin_log.is_open()) + { + int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length, - transactional_table, FALSE); + transactional_table, FALSE, errcode); + } if (!thd->current_stmt_binlog_row_based && !can_rollback_data()) thd->transaction.all.modified_non_trans_table= TRUE; if (changed) @@ -3658,10 +3674,14 @@ select_create::binlog_show_create_table(TABLE **tables, uint count) DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */ if (mysql_bin_log.is_open()) + { + int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); thd->binlog_query(THD::STMT_QUERY_TYPE, query.ptr(), query.length(), /* is_trans */ TRUE, - /* suppress_use */ FALSE); + /* suppress_use */ FALSE, + errcode); + } } void select_create::store_values(List<Item> &values) |