1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-27 09:01:50 +03:00

Fixed unit test failures caused by refactoring.

This commit is contained in:
Teemu Ollakka
2018-06-14 23:13:25 +03:00
parent 256000f934
commit cb3b2fbf9e
6 changed files with 22 additions and 22 deletions

View File

@ -327,7 +327,7 @@ namespace wsrep
int commit() int commit()
{ {
assert(mode_ == m_applier); assert(mode_ == m_applier || mode_ == m_local);
return client_service_.commit(*this, return client_service_.commit(*this,
transaction_.ws_handle(), transaction_.ws_meta()); transaction_.ws_handle(), transaction_.ws_meta());
} }
@ -351,19 +351,19 @@ namespace wsrep
int before_commit() int before_commit()
{ {
assert(state_ == s_exec); assert(state_ == s_exec || mode_ == m_local);
return transaction_.before_commit(); return transaction_.before_commit();
} }
int ordered_commit() int ordered_commit()
{ {
assert(state_ == s_exec); assert(state_ == s_exec || mode_ == m_local);
return transaction_.ordered_commit(); return transaction_.ordered_commit();
} }
int after_commit() int after_commit()
{ {
assert(state_ == s_exec); assert(state_ == s_exec || mode_ == m_local);
return transaction_.after_commit(); return transaction_.after_commit();
} }
@ -418,7 +418,7 @@ namespace wsrep
enum wsrep::provider::status replay( enum wsrep::provider::status replay(
wsrep::transaction_context& tc) wsrep::transaction_context& tc)
{ {
return client_service_.replay(tc); return client_service_.replay(*this, tc);
} }
// //

View File

@ -103,7 +103,9 @@ namespace wsrep
* \todo This should not be visible to DBMS level, should be * \todo This should not be visible to DBMS level, should be
* handled internally by wsrep-lib. * 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 * Wait until all replaying transactions have been finished

View File

@ -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) 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); return provider_.append_key(ws_handle_, key);
} }

View File

@ -71,10 +71,10 @@ namespace wsrep
{ return do_2pc_; } { return do_2pc_; }
bool interrupted() const WSREP_OVERRIDE bool interrupted() const WSREP_OVERRIDE
{ return false; } { return killed_before_certify_; }
void reset_globals() WSREP_OVERRIDE { } void reset_globals() WSREP_OVERRIDE { }
void emergency_shutdown() WSREP_OVERRIDE { } void emergency_shutdown() WSREP_OVERRIDE { ++aborts_; }
int append_fragment(const wsrep::transaction_context&, int append_fragment(const wsrep::transaction_context&,
int, const wsrep::const_buffer&) WSREP_OVERRIDE int, const wsrep::const_buffer&) WSREP_OVERRIDE
@ -85,10 +85,11 @@ namespace wsrep
WSREP_OVERRIDE { } WSREP_OVERRIDE { }
enum wsrep::provider::status 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( enum wsrep::provider::status ret(
provider_.replay(tc.ws_handle(), this)); provider_.replay(tc.ws_handle(), &client_context));
++replays_; ++replays_;
return ret; return ret;
} }
@ -140,9 +141,6 @@ namespace wsrep
return client_context.append_data(data); 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 store_globals() WSREP_OVERRIDE { }
void debug_sync(wsrep::client_context& client_context, void debug_sync(wsrep::client_context& client_context,

View File

@ -2,8 +2,8 @@
// Copyright (C) 2018 Codership Oy <info@codership.com> // Copyright (C) 2018 Codership Oy <info@codership.com>
// //
#ifndef WSREP_FAKE_PROVIDER_HPP #ifndef WSREP_MOCK_PROVIDER_HPP
#define WSREP_FAKE_PROVIDER_HPP #define WSREP_MOCK_PROVIDER_HPP
#include "wsrep/provider.hpp" #include "wsrep/provider.hpp"
#include "wsrep/logger.hpp" #include "wsrep/logger.hpp"
@ -154,8 +154,8 @@ namespace wsrep
enum wsrep::provider::status replay(wsrep::ws_handle&, void* ctx) enum wsrep::provider::status replay(wsrep::ws_handle&, void* ctx)
{ {
wsrep::mock_client_context& cc( wsrep::client_context& cc(
*static_cast<wsrep::mock_client_context*>(ctx)); *static_cast<wsrep::client_context*>(ctx));
wsrep::client_applier_mode applier_mode(cc); wsrep::client_applier_mode applier_mode(cc);
const wsrep::transaction_context& tc(cc.transaction()); const wsrep::transaction_context& tc(cc.transaction());
wsrep::ws_meta ws_meta; wsrep::ws_meta ws_meta;
@ -246,4 +246,4 @@ namespace wsrep
} }
#endif // WSREP_FAKE_PROVIDER_HPP #endif // WSREP_MOCK_PROVIDER_HPP

View File

@ -2,8 +2,8 @@
// Copyright (C) 2018 Codership Oy <info@codership.com> // Copyright (C) 2018 Codership Oy <info@codership.com>
// //
#ifndef WSREP_FAKE_SERVER_CONTEXT_HPP #ifndef WSREP_MOCK_SERVER_CONTEXT_HPP
#define WSREP_FAKE_SERVER_CONTEXT_HPP #define WSREP_MOCK_SERVER_CONTEXT_HPP
#include "wsrep/server_context.hpp" #include "wsrep/server_context.hpp"
#include "mock_client_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