diff --git a/include/wsrep/client_context.hpp b/include/wsrep/client_context.hpp index 09a72e9..6306993 100644 --- a/include/wsrep/client_context.hpp +++ b/include/wsrep/client_context.hpp @@ -327,7 +327,7 @@ namespace wsrep int commit() { - assert(mode_ == m_applier); + assert(mode_ == m_applier || mode_ == m_local); return client_service_.commit(*this, transaction_.ws_handle(), transaction_.ws_meta()); } @@ -351,19 +351,19 @@ namespace wsrep int before_commit() { - assert(state_ == s_exec); + assert(state_ == s_exec || mode_ == m_local); return transaction_.before_commit(); } int ordered_commit() { - assert(state_ == s_exec); + assert(state_ == s_exec || mode_ == m_local); return transaction_.ordered_commit(); } int after_commit() { - assert(state_ == s_exec); + assert(state_ == s_exec || mode_ == m_local); return transaction_.after_commit(); } @@ -418,7 +418,7 @@ namespace wsrep enum wsrep::provider::status replay( wsrep::transaction_context& tc) { - return client_service_.replay(tc); + return client_service_.replay(*this, tc); } // diff --git a/include/wsrep/client_service.hpp b/include/wsrep/client_service.hpp index 4afdc81..1ac5ecd 100644 --- a/include/wsrep/client_service.hpp +++ b/include/wsrep/client_service.hpp @@ -103,7 +103,9 @@ namespace wsrep * \todo This should not be visible to DBMS level, should be * handled internally by wsrep-lib. */ - virtual enum wsrep::provider::status replay(wsrep::transaction_context&) = 0; + virtual enum wsrep::provider::status replay( + wsrep::client_context&, + wsrep::transaction_context&) = 0; /*! * Wait until all replaying transactions have been finished diff --git a/src/transaction_context.cpp b/src/transaction_context.cpp index 4bb52b3..36068ce 100644 --- a/src/transaction_context.cpp +++ b/src/transaction_context.cpp @@ -95,7 +95,7 @@ int wsrep::transaction_context::start_replaying(const wsrep::ws_meta& ws_meta) int wsrep::transaction_context::append_key(const wsrep::key& key) { - + /*! \todo Collect table level keys for SR commit */ return provider_.append_key(ws_handle_, key); } diff --git a/test/mock_client_context.hpp b/test/mock_client_context.hpp index 1388bd9..fbb4730 100644 --- a/test/mock_client_context.hpp +++ b/test/mock_client_context.hpp @@ -71,10 +71,10 @@ namespace wsrep { return do_2pc_; } bool interrupted() const WSREP_OVERRIDE - { return false; } + { return killed_before_certify_; } void reset_globals() WSREP_OVERRIDE { } - void emergency_shutdown() WSREP_OVERRIDE { } + void emergency_shutdown() WSREP_OVERRIDE { ++aborts_; } int append_fragment(const wsrep::transaction_context&, int, const wsrep::const_buffer&) WSREP_OVERRIDE @@ -85,10 +85,11 @@ namespace wsrep WSREP_OVERRIDE { } enum wsrep::provider::status - replay(wsrep::transaction_context& tc) WSREP_OVERRIDE + replay(wsrep::client_context& client_context, + wsrep::transaction_context& tc) WSREP_OVERRIDE { enum wsrep::provider::status ret( - provider_.replay(tc.ws_handle(), this)); + provider_.replay(tc.ws_handle(), &client_context)); ++replays_; return ret; } @@ -140,9 +141,6 @@ namespace wsrep return client_context.append_data(data); } - bool killed() const WSREP_OVERRIDE { return killed_before_certify_; } - void abort() WSREP_OVERRIDE { ++aborts_; } - void store_globals() WSREP_OVERRIDE { } void debug_sync(wsrep::client_context& client_context, diff --git a/test/mock_provider.hpp b/test/mock_provider.hpp index 79d216c..6af06b9 100644 --- a/test/mock_provider.hpp +++ b/test/mock_provider.hpp @@ -2,8 +2,8 @@ // Copyright (C) 2018 Codership Oy // -#ifndef WSREP_FAKE_PROVIDER_HPP -#define WSREP_FAKE_PROVIDER_HPP +#ifndef WSREP_MOCK_PROVIDER_HPP +#define WSREP_MOCK_PROVIDER_HPP #include "wsrep/provider.hpp" #include "wsrep/logger.hpp" @@ -154,8 +154,8 @@ namespace wsrep enum wsrep::provider::status replay(wsrep::ws_handle&, void* ctx) { - wsrep::mock_client_context& cc( - *static_cast(ctx)); + wsrep::client_context& cc( + *static_cast(ctx)); wsrep::client_applier_mode applier_mode(cc); const wsrep::transaction_context& tc(cc.transaction()); wsrep::ws_meta ws_meta; @@ -246,4 +246,4 @@ namespace wsrep } -#endif // WSREP_FAKE_PROVIDER_HPP +#endif // WSREP_MOCK_PROVIDER_HPP diff --git a/test/mock_server_context.hpp b/test/mock_server_context.hpp index a98c406..9f05234 100644 --- a/test/mock_server_context.hpp +++ b/test/mock_server_context.hpp @@ -2,8 +2,8 @@ // Copyright (C) 2018 Codership Oy // -#ifndef WSREP_FAKE_SERVER_CONTEXT_HPP -#define WSREP_FAKE_SERVER_CONTEXT_HPP +#ifndef WSREP_MOCK_SERVER_CONTEXT_HPP +#define WSREP_MOCK_SERVER_CONTEXT_HPP #include "wsrep/server_context.hpp" #include "mock_client_context.hpp" @@ -78,4 +78,4 @@ namespace wsrep }; } -#endif // WSREP_FAKE_SERVER_CONTEXT_HPP +#endif // WSREP_MOCK_SERVER_CONTEXT_HPP