diff options
author | Luis Soares <luis.soares@sun.com> | 2009-09-24 15:52:52 +0100 |
---|---|---|
committer | Luis Soares <luis.soares@sun.com> | 2009-09-24 15:52:52 +0100 |
commit | 9ae9f84ef45b57e29c328f9449004c07f8a62e3a (patch) | |
tree | 853b60ee4d659a71d405efc7d93c0968b3f44bd5 /sql | |
parent | e3f7f7a5c9a0a13440793416d0ce6bf5da9d697d (diff) | |
download | mariadb-git-9ae9f84ef45b57e29c328f9449004c07f8a62e3a.tar.gz |
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.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_base.cc | 12 | ||||
-rw-r--r-- | sql/sql_class.cc | 6 |
2 files changed, 17 insertions, 1 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index f55d3fc5006..7de345ba0e7 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -24,6 +24,7 @@ #include <m_ctype.h> #include <my_dir.h> #include <hash.h> +#include "rpl_filter.h" #ifdef __WIN__ #include <io.h> #endif @@ -5094,7 +5095,16 @@ static void mark_real_tables_as_free_for_reuse(TABLE_LIST *table) int decide_logging_format(THD *thd, TABLE_LIST *tables) { - if (mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG)) + /* + In SBR mode, we are only proceeding if we are binlogging this + statement, ie, the filtering rules won't later filter this out. + + This check here is needed to prevent some spurious error to be + raised in some cases (See BUG#42829). + */ + if (mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG) && + (thd->variables.binlog_format != BINLOG_FORMAT_STMT || + binlog_filter->db_ok(thd->db))) { /* Compute the starting vectors for the computations by creating a 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 */ /**************************************************************************** |