From ed9f68f6ad3417f4e12acd8c108a3fd9cc727111 Mon Sep 17 00:00:00 2001 From: sjaakola Date: Thu, 27 Jul 2017 11:39:31 +0300 Subject: [PATCH] MW-394 * changed thd_binlog_format to return configured binlog format in wsrep execution, regardless of binlogging setting (i.e. with or without binlogging) * thd_binlog_format is used in innobase::write_row(), and would return confusing result there when log_bin==OFF --- sql/sql_class.cc | 12 +++++++++--- sql/wsrep_mysqld.h | 5 +++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 9aedba3c426..82b2faf6a02 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -4852,9 +4852,15 @@ extern "C" int thd_non_transactional_update(const MYSQL_THD thd) extern "C" int thd_binlog_format(const MYSQL_THD thd) { - if (((WSREP(thd) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()) && - thd->variables.option_bits & OPTION_BIN_LOG) - return (int) thd->wsrep_binlog_format(); +#ifdef WITH_WSREP + if (WSREP(thd)) + { + /* for wsrep binlog format is meaningful also when binlogging is off */ + return (int) WSREP_BINLOG_FORMAT(thd->variables.binlog_format); + } +#endif /* WITH_WSREP */ + if (mysql_bin_log.is_open() && (thd->variables.option_bits & OPTION_BIN_LOG)) + return (int) thd->variables.binlog_format; else return BINLOG_FORMAT_UNSPEC; } diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 3d46e17af99..f154b51516b 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -320,6 +320,10 @@ bool wsrep_create_like_table(THD* thd, TABLE_LIST* table, bool wsrep_node_is_donor(); bool wsrep_node_is_synced(); +#define WSREP_BINLOG_FORMAT(my_format) \ + ((wsrep_forced_binlog_format != BINLOG_FORMAT_UNSPEC) ? \ + wsrep_forced_binlog_format : my_format) + #else /* WITH_WSREP */ #define WSREP(T) (0) @@ -349,6 +353,7 @@ bool wsrep_node_is_synced(); #define wsrep_thr_init() do {} while(0) #define wsrep_thr_deinit() do {} while(0) #define wsrep_running_threads (0) +#define WSREP_BINLOG_FORMAT(my_format) my_format #endif /* WITH_WSREP */ #endif /* WSREP_MYSQLD_H */