From e1ed3dcebf649a540a8a5fd6293ef1494757fb38 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Tue, 10 Dec 2013 11:30:23 -0500 Subject: MDEV#5407, MDEV#5386, MVED#4222 Problem: As, wsrep_provider is dynamic and can accept a valid provider while server is running. Patch for #4222 wrongly skips the initialization of binlog plugin during server start, when wsrep provider is not specified. In wsrep build, if opt_log_bin is not provided, we still init binlog with wsrep_emulate_bin_log ON. Fix: This patch fixes #4222 by adding a check to return from binlog_savepoint_set without proceeding further if wsrep_on is OFF/false. This patch also fixes MDEV#5407 and reverts changes pushed for MDEV#5386 (no longer valid). --- sql/log.cc | 10 +++++++++- sql/sql_base.cc | 6 ------ 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'sql') diff --git a/sql/log.cc b/sql/log.cc index 850980f04f7..242c45a7ed7 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1708,7 +1708,7 @@ int binlog_init(void *p) { binlog_hton= (handlerton *)p; #ifdef WITH_WSREP - if (WSREP_ON && WSREP_PROVIDER_EXISTS) + if (WSREP_ON) binlog_hton->state= SHOW_OPTION_YES; else { @@ -2217,6 +2217,14 @@ static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv) { DBUG_ENTER("binlog_savepoint_set"); +#ifdef WITH_WSREP + /* + If wsrep_emulate_bin_log is true, (i.e opt_bin_log == false), + we should return from here if wsrep_on is off. + */ + if (wsrep_emulate_bin_log && !WSREP(thd)) DBUG_RETURN(0); +#endif /* WITH_WSREP */ + binlog_trans_log_savepos(thd, (my_off_t*) sv); /* Write it to the binary log */ #ifdef WITH_WSREP diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 62fb340cc6e..3acfa63d55e 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -62,7 +62,6 @@ #ifdef WITH_WSREP #include "wsrep_mysqld.h" -extern handlerton *binlog_hton; #endif // WITH_WSREP bool @@ -1575,11 +1574,6 @@ void close_thread_tables(THD *thd) handled either before writing a query log event (inside binlog_query()) or when preparing a pending event. */ -#ifdef WITH_WSREP - /* In Galera binlog is not enabled by default in case when - wsrep provider is not specified. */ - if ((WSREP_ON && WSREP_PROVIDER_EXISTS) || binlog_hton->state == SHOW_OPTION_YES) -#endif (void)thd->binlog_flush_pending_rows_event(TRUE); mysql_unlock_tables(thd, thd->lock); thd->lock=0; -- cgit v1.2.1