diff options
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 1ddb2063faa..705b760732e 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -5588,13 +5588,26 @@ static bool check_table_binlog_row_based(THD *thd, TABLE *table) DBUG_ASSERT(table->s->cached_row_logging_check == 0 || table->s->cached_row_logging_check == 1); - return thd->is_current_stmt_binlog_format_row() && + return (thd->is_current_stmt_binlog_format_row() && table->s->cached_row_logging_check && - (thd->variables.option_bits & OPTION_BIN_LOG) && - /* applier and replayer should not binlog */ - ((IF_WSREP(WSREP_EMULATE_BINLOG(thd) && - thd->wsrep_exec_mode != REPL_RECV, 0)) || - mysql_bin_log.is_open()); + /* + Wsrep partially enables binary logging if it have not been + explicitly turned on. As a result we return 'true' if we are in + wsrep binlog emulation mode and the current thread is not a wsrep + applier or replayer thread. This decision is not affected by + @@sql_log_bin as we want the events to make into the binlog + cache only to filter them later before they make into binary log + file. + + However, we do return 'false' if binary logging was temporarily + turned off (see tmp_disable_binlog(A)). + + Otherwise, return 'true' if binary logging is on. + */ + (thd->variables.sql_log_bin_off != 1) && + ((WSREP_EMULATE_BINLOG(thd) && (thd->wsrep_exec_mode != REPL_RECV)) || + ((WSREP(thd) || (thd->variables.option_bits & OPTION_BIN_LOG)) && + mysql_bin_log.is_open()))); } |