diff options
Diffstat (limited to 'sql/wsrep_hton.cc')
-rw-r--r-- | sql/wsrep_hton.cc | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc index 8ef51548e79..f45ba5e5a39 100644 --- a/sql/wsrep_hton.cc +++ b/sql/wsrep_hton.cc @@ -1,4 +1,4 @@ -/* Copyright 2008 Codership Oy <http://www.codership.com> +/* Copyright 2008-2015 Codership Oy <http://www.codership.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ #include <sql_class.h> #include "wsrep_mysqld.h" #include "wsrep_binlog.h" +#include "wsrep_xid.h" #include <cstdio> #include <cstdlib> @@ -96,17 +97,40 @@ void wsrep_register_hton(THD* thd, bool all) */ void wsrep_post_commit(THD* thd, bool all) { - if (thd->wsrep_exec_mode == LOCAL_COMMIT) + /* + TODO: It can perhaps be fixed in a more elegant fashion by turning off + wsrep_emulate_binlog if wsrep_on=0 on server start. + https://github.com/codership/mysql-wsrep/issues/112 + */ + if (!WSREP_ON) + return; + + switch (thd->wsrep_exec_mode) { - DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED); - if (wsrep->post_commit(wsrep, &thd->wsrep_ws_handle)) + case LOCAL_COMMIT: { + DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED); + if (wsrep->post_commit(wsrep, &thd->wsrep_ws_handle)) + { DBUG_PRINT("wsrep", ("set committed fail")); WSREP_WARN("set committed fail: %llu %d", (long long)thd->real_id, thd->get_stmt_da()->status()); + } + wsrep_cleanup_transaction(thd); + break; } - wsrep_cleanup_transaction(thd); + case LOCAL_STATE: + { + /* + Non-InnoDB statements may have populated events in stmt cache => cleanup + */ + WSREP_DEBUG("cleanup transaction for LOCAL_STATE: %s", thd->query()); + wsrep_cleanup_transaction(thd); + break; + } + default: break; } + } /* @@ -489,7 +513,7 @@ wsrep_run_wsrep_commit(THD *thd, bool all) if (thd->transaction.xid_state.xid.get_my_xid()) { wsrep_xid_init(&thd->transaction.xid_state.xid, - &thd->wsrep_trx_meta.gtid.uuid, + thd->wsrep_trx_meta.gtid.uuid, thd->wsrep_trx_meta.gtid.seqno); } DBUG_PRINT("wsrep", ("replicating commit success")); |