From 6271c06a73ce1065ac53a554e42a0049bf77eb53 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Fri, 29 Nov 2013 12:50:31 -0500 Subject: [PATCH] MDEV-4222: Assertion `( ((global_system_variables.wsrep_on) && (thd && thd->variables.wsrep_on)) && wsrep_emulate_bin_log) || mysql_bin_log .is_open()' fails on SAVEPOINT with disabled wsrep_provider As wsrep_on system variable is ON by default the binlog handlerton is implicitly enabled during the server initialization phase. Later, while wsrep plugin is getting initialized, wsrep_on in corrected & turned OFF in case wsrep provider is not specified (leaving binlog in ON state!). This leads to the reported assertion. Fixed by adding another check for wsrep provider before binlog is enabled. Added a test case. --- mysql-test/suite/wsrep/r/trans.result | 9 +++++++++ mysql-test/suite/wsrep/t/trans.test | 13 +++++++++++++ sql/log.cc | 2 +- sql/mysqld.cc | 4 ++-- sql/wsrep_mysqld.cc | 6 ++---- sql/wsrep_mysqld.h | 3 +++ 6 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 mysql-test/suite/wsrep/r/trans.result create mode 100644 mysql-test/suite/wsrep/t/trans.test diff --git a/mysql-test/suite/wsrep/r/trans.result b/mysql-test/suite/wsrep/r/trans.result new file mode 100644 index 00000000000..bc225897103 --- /dev/null +++ b/mysql-test/suite/wsrep/r/trans.result @@ -0,0 +1,9 @@ +# +# MDEV-4222 : Assertion `( ((global_system_variables.wsrep_on) && +# (thd && thd->variables.wsrep_on)) && srep_emulate_bin_log) +# || mysql_bin_log .is_open()' fails on SAVEPOINT with +# disabled wsrep_provider +# +START TRANSACTION WITH CONSISTENT SNAPSHOT; +SAVEPOINT A; +End of test. diff --git a/mysql-test/suite/wsrep/t/trans.test b/mysql-test/suite/wsrep/t/trans.test new file mode 100644 index 00000000000..9278ef12072 --- /dev/null +++ b/mysql-test/suite/wsrep/t/trans.test @@ -0,0 +1,13 @@ +--source include/have_innodb.inc + +--echo # +--echo # MDEV-4222 : Assertion `( ((global_system_variables.wsrep_on) && +--echo # (thd && thd->variables.wsrep_on)) && srep_emulate_bin_log) +--echo # || mysql_bin_log .is_open()' fails on SAVEPOINT with +--echo # disabled wsrep_provider +--echo # + +START TRANSACTION WITH CONSISTENT SNAPSHOT; +SAVEPOINT A; + +--echo End of test. diff --git a/sql/log.cc b/sql/log.cc index 64174a9a454..850980f04f7 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) + if (WSREP_ON && WSREP_PROVIDER_EXISTS) binlog_hton->state= SHOW_OPTION_YES; else { diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 223482f36b9..80aa5c6a2f1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4909,7 +4909,7 @@ pthread_handler_t start_wsrep_THD(void *arg) void wsrep_create_rollbacker() { - if (wsrep_provider && strcasecmp(wsrep_provider, "none")) + if (WSREP_PROVIDER_EXISTS) { pthread_t hThread; /* create rollbacker */ @@ -4925,7 +4925,7 @@ void wsrep_create_appliers(long threads) { /* see wsrep_replication_start() for the logic */ if (wsrep_cluster_address && strlen(wsrep_cluster_address) && - wsrep_provider && strcasecmp(wsrep_provider, "none")) + WSREP_PROVIDER_EXISTS) { WSREP_ERROR("Trying to launch slave threads before creating " "connection at '%s'", wsrep_cluster_address); diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index d09ca660501..39c8349c4f2 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -438,8 +438,7 @@ int wsrep_init() } } - if (strlen(wsrep_provider)== 0 || - !strcmp(wsrep_provider, WSREP_NONE)) + if (!WSREP_PROVIDER_EXISTS) { // enable normal operation in case no provider is specified wsrep_ready_set(TRUE); @@ -662,8 +661,7 @@ bool wsrep_start_replication() if provider is trivial, don't even try to connect, but resume local node operation */ - if (strlen(wsrep_provider)== 0 || - !strcmp(wsrep_provider, WSREP_NONE)) + if (!WSREP_PROVIDER_EXISTS) { // enable normal operation in case no provider is specified wsrep_ready_set(TRUE); diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index cbc3f4cf3d1..20d356a22a9 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -286,6 +286,9 @@ extern wsrep_seqno_t wsrep_locked_seqno; if (victim_thd) WSREP_LOG_CONFLICT_THD(victim_thd, "Victim thread"); \ } +#define WSREP_PROVIDER_EXISTS \ + (wsrep_provider && strncasecmp(wsrep_provider, WSREP_NONE, FN_REFLEN)) + /*! Synchronizes applier thread start with init thread */ extern void wsrep_sst_grab(); /*! Init thread waits for SST completion */