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

codership/wsrep-lib#52 Removed client_service do_2pc()

This commit is contained in:
Teemu Ollakka
2019-01-16 15:00:20 +02:00
parent 89b3561ad8
commit 55f6c63328
8 changed files with 5 additions and 20 deletions

View File

@ -27,11 +27,6 @@ db::client_service::client_service(db::client& client)
, client_state_(client_.client_state())
{ }
bool db::client_service::do_2pc() const
{
return client_.do_2pc();
}
int db::client_service::bf_rollback()
{
int ret(client_state_.before_rollback());

View File

@ -33,7 +33,6 @@ namespace db
public:
client_service(db::client& client);
bool do_2pc() const override;
bool interrupted() const override { return false; }
void reset_globals() override { }
void store_globals() override { }

View File

@ -40,15 +40,6 @@ namespace wsrep
public:
client_service() { }
virtual ~client_service() { }
/**
* Return true if two pahase commit is required for transaction
* to commit.
*
* @todo This interface method should be deprecated, 1pc vs 2pc
* will be deduced from transaction states in
* transaction::before_commit() call.
*/
virtual bool do_2pc() const = 0;
/**
* Return true if the current transaction has been interrupted

View File

@ -374,7 +374,6 @@ int wsrep::transaction::before_commit()
case wsrep::client_state::m_local:
if (state() == s_executing)
{
assert(client_service_.do_2pc() == false);
ret = before_prepare(lock) || after_prepare(lock);
assert((ret == 0 && state() == s_committing)
||

View File

@ -77,9 +77,6 @@ namespace wsrep
int bf_rollback() WSREP_OVERRIDE;
bool do_2pc() const WSREP_OVERRIDE
{ return do_2pc_; }
bool interrupted() const WSREP_OVERRIDE
{ return killed_before_certify_; }

View File

@ -48,7 +48,7 @@ int wsrep::mock_high_priority_service::commit(
{
int ret(0);
client_state_->prepare_for_ordering(ws_handle, ws_meta, true);
if (client_state_->client_service().do_2pc())
if (do_2pc_)
{
ret = client_state_->before_prepare() ||
client_state_->after_prepare();

View File

@ -33,6 +33,7 @@ namespace wsrep
wsrep::mock_client_state* client_state,
bool replaying)
: wsrep::high_priority_service(server_state)
, do_2pc_()
, fail_next_applying_()
, fail_next_toi_()
, client_state_(client_state)
@ -74,6 +75,7 @@ namespace wsrep
{
return client_state_;
}
bool do_2pc_;
bool fail_next_applying_;
bool fail_next_toi_;
private:

View File

@ -226,6 +226,7 @@ BOOST_FIXTURE_TEST_CASE(server_state_applying_1pc,
BOOST_FIXTURE_TEST_CASE(server_state_applying_2pc,
applying_server_fixture)
{
hps.do_2pc_ = true;
char buf[1] = { 1 };
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta,
wsrep::const_buffer(buf, 1)) == 0);
@ -251,6 +252,7 @@ BOOST_FIXTURE_TEST_CASE(server_state_applying_1pc_rollback,
BOOST_FIXTURE_TEST_CASE(server_state_applying_2pc_rollback,
applying_server_fixture)
{
hps.do_2pc_ = true;
hps.fail_next_applying_ = true;
char buf[1] = { 1 };
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta,