1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-06-14 15:02:27 +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

@ -96,6 +96,32 @@ int wsrep::mock_high_priority_service::apply_toi(const wsrep::ws_meta&,
return (fail_next_toi_ ? 1 : 0);
}
int wsrep::mock_high_priority_service::apply_nbo_begin(
const wsrep::ws_meta& ws_meta,
const wsrep::const_buffer&)
{
const int nbo_begin_flags(wsrep::provider::flag::isolation |
wsrep::provider::flag::start_transaction);
assert(ws_meta.flags() & nbo_begin_flags);
assert((ws_meta.flags() & ~nbo_begin_flags) == 0);
if (fail_next_toi_)
{
return 1;
}
else
{
nbo_cs_ = std::unique_ptr<wsrep::mock_client>(
new wsrep::mock_client(client_state_->server_state(),
wsrep::client_id(1),
wsrep::client_state::m_local));
nbo_cs_->open(wsrep::client_id(1));
nbo_cs_->before_command();
nbo_cs_->before_statement();
return nbo_cs_->enter_nbo_mode(ws_meta);
}
}
void wsrep::mock_high_priority_service::adopt_apply_error(
wsrep::mutable_buffer& err)
{