summaryrefslogtreecommitdiff
path: root/sql/wsrep_hton.cc
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2018-07-24 14:54:50 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2018-07-24 14:54:50 +0300
commitc863159c320008676aff978a7cdde5732678f975 (patch)
treec27120ce7a1aa6ea6199a203f8a40f1c74fe8d1d /sql/wsrep_hton.cc
parentf99fe68b4fb7ca1715d059d283e50f050f692294 (diff)
downloadmariadb-git-c863159c320008676aff978a7cdde5732678f975.tar.gz
MDEV-16799: Test wsrep.variables crash at sql_class.cc:639 thd_get_ha_data
Problem was that binlog_hton was not initialized fully when needed i.e. when wsrep_on = true.
Diffstat (limited to 'sql/wsrep_hton.cc')
-rw-r--r--sql/wsrep_hton.cc21
1 files changed, 14 insertions, 7 deletions
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc
index 0a2264ac03c..734a0686a6d 100644
--- a/sql/wsrep_hton.cc
+++ b/sql/wsrep_hton.cc
@@ -24,6 +24,8 @@
#include <cstdlib>
#include "debug_sync.h"
+extern handlerton *binlog_hton;
+extern int binlog_close_connection(handlerton *hton, THD *thd);
extern ulonglong thd_to_trx_id(THD *thd);
extern "C" int thd_binlog_format(const MYSQL_THD thd);
@@ -173,7 +175,10 @@ wsrep_close_connection(handlerton* hton, THD* thd)
{
DBUG_RETURN(0);
}
- DBUG_RETURN(wsrep_binlog_close_connection (thd));
+
+ if (wsrep_emulate_bin_log && thd_get_ha_data(thd, binlog_hton) != NULL)
+ binlog_hton->close_connection (binlog_hton, thd);
+ DBUG_RETURN(0);
}
/*
@@ -256,9 +261,9 @@ static int wsrep_rollback(handlerton *hton, THD *thd, bool all)
}
if ((all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
- thd->wsrep_conflict_state != MUST_REPLAY)
+ thd->variables.wsrep_on && thd->wsrep_conflict_state != MUST_REPLAY)
{
- if (WSREP(thd) && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
+ if (wsrep && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
{
DBUG_PRINT("wsrep", ("setting rollback fail"));
WSREP_ERROR("settting rollback fail: thd: %llu, schema: %s, SQL: %s",
@@ -299,12 +304,14 @@ int wsrep_commit(handlerton *hton, THD *thd, bool all)
Transaction didn't go through wsrep->pre_commit() so just roll back
possible changes to clean state.
*/
- if (WSREP(thd) && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
- {
- DBUG_PRINT("wsrep", ("setting rollback fail"));
- WSREP_ERROR("settting rollback fail: thd: %llu, schema: %s, SQL: %s",
+ if (WSREP_PROVIDER_EXISTS) {
+ if (wsrep && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
+ {
+ DBUG_PRINT("wsrep", ("setting rollback fail"));
+ WSREP_ERROR("settting rollback fail: thd: %llu, schema: %s, SQL: %s",
(long long)thd->real_id, (thd->db ? thd->db : "(null)"),
thd->query());
+ }
}
wsrep_cleanup_transaction(thd);
}