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

NBO applying

- High priority interface method to apply NBO begin, separate from
  apply_toi() in order to avoid implementation to force interpreting
  ws_meta flags.
- Method to put client_state into NBO mode when applying NBO begin.
  The client_state will process in m_local mode.
- Unit tests for applying NBO
This commit is contained in:
Teemu Ollakka
2019-06-06 15:50:58 +03:00
parent 1267e29b8f
commit 85a03394cc
12 changed files with 182 additions and 9 deletions

View File

@ -23,6 +23,8 @@
#include "wsrep/high_priority_service.hpp"
#include "mock_client_state.hpp"
#include <memory>
namespace wsrep
{
class mock_high_priority_service : public wsrep::high_priority_service
@ -38,8 +40,11 @@ namespace wsrep
, fail_next_toi_()
, client_state_(client_state)
, replaying_(replaying)
, nbo_cs_()
{ }
~mock_high_priority_service()
{ }
int start_transaction(const wsrep::ws_handle&, const wsrep::ws_meta&)
WSREP_OVERRIDE;
@ -65,6 +70,8 @@ namespace wsrep
int apply_toi(const wsrep::ws_meta&,
const wsrep::const_buffer&,
wsrep::mutable_buffer&) WSREP_OVERRIDE;
int apply_nbo_begin(const wsrep::ws_meta&,
const wsrep::const_buffer&) WSREP_OVERRIDE;
void adopt_apply_error(wsrep::mutable_buffer& err) WSREP_OVERRIDE;
void after_apply() WSREP_OVERRIDE;
void store_globals() WSREP_OVERRIDE { }
@ -84,11 +91,19 @@ namespace wsrep
bool do_2pc_;
bool fail_next_applying_;
bool fail_next_toi_;
wsrep::mock_client* nbo_cs() const { return nbo_cs_.get(); }
private:
mock_high_priority_service(const mock_high_priority_service&);
mock_high_priority_service& operator=(const mock_high_priority_service&);
wsrep::mock_client_state* client_state_;
bool replaying_;
/* Client state associated to NBO processing. This should be
* stored elsewhere (like mock_server_state), but is kept
* here for convenience. */
std::unique_ptr<wsrep::mock_client> nbo_cs_;
};
}