From 9ae9f84ef45b57e29c328f9449004c07f8a62e3a Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 24 Sep 2009 15:52:52 +0100 Subject: BUG#42829: binlogging enabled for all schemas regardless of binlog-db-db / binlog-ignore-db InnoDB will return an error if statement based replication is used along with transaction isolation level READ-COMMITTED (or weaker), even if the statement in question is filtered out according to the binlog-do-db rules set. In this case, an error should not be printed. This patch addresses this issue by extending the existing check in external_lock to take into account the filter rules before deciding to print an error. Furthermore, it also changes decide_logging_format to take into consideration whether the statement is filtered out from binlog before decision is made. sql/sql_base.cc: Changed the check on decide_logging_format to take into account whether statement is filtered or not in SBR. sql/sql_class.cc: Added the thd_binlog_filter_ok to INNODB_COMPATIBILITY_HOOKS set. storage/innobase/handler/ha_innodb.cc: Extended check in external_lock to take into consideration the filtering when deciding to throw an error. storage/innobase/handler/ha_innodb.h: Added declaration of new hook. storage/innodb_plugin/handler/ha_innodb.cc: Extended check in external_lock to take into consideration the filtering when deciding to throw an error. storage/innodb_plugin/handler/ha_innodb.h: Added declaration of new hook. --- sql/sql_class.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sql/sql_class.cc') diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 3f568566c89..9269e97cc4c 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -42,6 +42,7 @@ #include "sp_rcontext.h" #include "sp_cache.h" +#include "rpl_filter.h" /* The following is used to initialise Table_ident with a internal @@ -2980,6 +2981,11 @@ extern "C" void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all) { mark_transaction_to_rollback(thd, all); } + +extern "C" bool thd_binlog_filter_ok(const MYSQL_THD thd) +{ + return binlog_filter->db_ok(thd->db); +} #endif // INNODB_COMPATIBILITY_HOOKS */ /**************************************************************************** -- cgit v1.2.1 From f130de4fb843c7623bb6cb742bc2acc5d82d7cd8 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov Date: Wed, 28 Oct 2009 17:49:56 +0300 Subject: A patch and a test case for Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT FOR UPDATE. If a transaction was rolled back inside InnoDB due to a deadlock or lock wait timeout, and the statement had IGNORE clause, the server could crash at the end of the statement or on shutdown. This was caused by the error handling infrastructure's attempt to ignore a non-ignorable error. When a transaction rollback request is raised, switch off current_select->no_error flag, so that the following error won't be ignored. Instead, we could add !thd->is_fatal_sub_stmt_error to my_message_sql(), but since in write_record() we switch off no_error, the same approach is used in thd_mark_transaction_to_rollback(). @todo: call thd_mark_transaction_to_rollback() from handler::print_error(), then we can easily make sure that the error reported by print_error is not ignored. mysql-test/r/innodb_lock_wait_timeout_1.result: Update results (Bug#46539). mysql-test/t/innodb_lock_wait_timeout_1.test: Add a test case for Bug#46539 sql/sql_class.cc: When a transaction rollback request is raised, switch of current_select->no_error flag, so that the following error won't be ignored. --- sql/sql_class.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sql/sql_class.cc') diff --git a/sql/sql_class.cc b/sql/sql_class.cc index aa556810402..080839e9b42 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3215,6 +3215,16 @@ void mark_transaction_to_rollback(THD *thd, bool all) { thd->is_fatal_sub_stmt_error= TRUE; thd->transaction_rollback_request= all; + /* + Aborted transactions can not be IGNOREd. + Switch off the IGNORE flag for the current + SELECT_LEX. This should allow my_error() + to report the error and abort the execution + flow, even in presence + of IGNORE clause. + */ + if (thd->lex->current_select) + thd->lex->current_select->no_error= FALSE; } } /*************************************************************************** -- cgit v1.2.1 From 9d96cd6dcb3f171cbbe93c0f7061ce132a9087a7 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 30 Oct 2009 15:15:43 +0200 Subject: Bug #48291 : crash with row() operator,select into @var, and subquery returning multiple rows Error handling was missing when handling subqueires in WHERE and when assigning a SELECT result to a @variable. This caused crash(es). Fixed by adding error handling code to both the WHERE condition evaluation and to assignment to an @variable. --- sql/sql_class.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sql/sql_class.cc') diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 7d26759cb16..06f2229a050 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2068,9 +2068,11 @@ bool select_dumpvar::send_data(List &items) else { Item_func_set_user_var *suv= new Item_func_set_user_var(mv->s, item); - suv->fix_fields(thd, 0); + if (suv->fix_fields(thd, 0)) + DBUG_RETURN (1); suv->save_item_result(item); - suv->update(); + if (suv->update()) + DBUG_RETURN (1); } } DBUG_RETURN(0); -- cgit v1.2.1