1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-30 07:23:07 +03:00
- populate and pass real error description buffer to provider in case
   of applying error
 - return 0 from server_state::on_apply() if error voting confirmed
   consistency
 - remove fragments and rollback after fragment applying failure
 - always release streaming applier on commit or rollback
This commit is contained in:
Alexey Yurchenko
2019-04-30 19:00:48 +03:00
parent fd66bdef0b
commit 0f676bd893
22 changed files with 470 additions and 187 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 Codership Oy <info@codership.com>
* Copyright (C) 2018-2019 Codership Oy <info@codership.com>
*
* This file is part of wsrep-lib.
*
@ -19,6 +19,7 @@
#include "mock_high_priority_service.hpp"
#include "mock_server_state.hpp"
#include <sstream>
int wsrep::mock_high_priority_service::start_transaction(
const wsrep::ws_handle& ws_handle, const wsrep::ws_meta& ws_meta)
@ -34,13 +35,25 @@ int wsrep::mock_high_priority_service::adopt_transaction(
}
int wsrep::mock_high_priority_service::apply_write_set(
const wsrep::ws_meta&,
const wsrep::const_buffer&)
const wsrep::ws_meta& meta,
const wsrep::const_buffer&,
wsrep::mutable_buffer& err)
{
assert(client_state_->toi_meta().seqno().is_undefined());
assert(client_state_->transaction().state() == wsrep::transaction::s_executing ||
client_state_->transaction().state() == wsrep::transaction::s_replaying);
return (fail_next_applying_ ? 1 : 0);
if (fail_next_applying_)
{
std::ostringstream os;
os << "failed " << meta;
err.push_back(os.str());
assert(err.size() > 0);
return 1;
}
else
{
return 0;
};
}
int wsrep::mock_high_priority_service::commit(
@ -69,14 +82,29 @@ int wsrep::mock_high_priority_service::rollback(
}
int wsrep::mock_high_priority_service::apply_toi(const wsrep::ws_meta&,
const wsrep::const_buffer&)
const wsrep::const_buffer&,
wsrep::mutable_buffer&)
{
assert(client_state_->transaction().active() == false);
assert(client_state_->toi_meta().seqno().is_undefined() == false);
return (fail_next_toi_ ? 1 : 0);
}
void wsrep::mock_high_priority_service::adopt_apply_error(
wsrep::mutable_buffer& err)
{
client_state_->adopt_apply_error(err);
}
void wsrep::mock_high_priority_service::after_apply()
{
client_state_->after_applying();
}
int wsrep::mock_high_priority_service::log_dummy_write_set(
const wsrep::ws_handle&,
const wsrep::ws_meta&,
wsrep::mutable_buffer& err)
{
return err.size() > 0;
}