1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-31 18:24:25 +03:00

SST sent/received impls for mock provider, added assertions

This commit is contained in:
Teemu Ollakka
2018-05-06 15:43:07 +03:00
parent e7cabb713f
commit abf8ef34fc
3 changed files with 25 additions and 15 deletions

View File

@ -57,7 +57,7 @@ public:
dbms_storage_engine() dbms_storage_engine()
: mutex_() : mutex_()
, transactions_() , transactions_()
, alg_freq_(100) , alg_freq_(0)
, bf_aborts_() , bf_aborts_()
{ } { }
@ -343,6 +343,7 @@ private:
} }
int commit(trrep::transaction_context& transaction_context) override int commit(trrep::transaction_context& transaction_context) override
{ {
assert(mode() == trrep::client_context::m_applier);
int ret(0); int ret(0);
ret = transaction_context.before_commit(); ret = transaction_context.before_commit();
ret = ret || transaction_context.ordered_commit(); ret = ret || transaction_context.ordered_commit();
@ -461,7 +462,7 @@ private:
void report_progress(size_t i) const void report_progress(size_t i) const
{ {
if ((i % 100) == 0) if ((i % 1000) == 0)
{ {
trrep::log() << "client: " << id().get() trrep::log() << "client: " << id().get()
<< " transactions: " << i << " transactions: " << i

View File

@ -105,14 +105,23 @@ namespace trrep
int replay(wsrep_ws_handle_t*, void*) { ::abort(); /* not impl */} int replay(wsrep_ws_handle_t*, void*) { ::abort(); /* not impl */}
int sst_sent(const wsrep_gtid_t&, int) { return 0; }
int sst_received(const wsrep_gtid_t&, int) { return 0; }
std::vector<status_variable> status() const
{
return std::vector<status_variable>();
}
// Methods to modify mock state // Methods to modify mock state
// Inject BF abort event into the provider. /*! Inject BF abort event into the provider.
// *
// @param bf_seqno Aborter sequence number * \param bf_seqno Aborter sequence number
// @param trx_id Trx id to be aborted * \param trx_id Trx id to be aborted
// @param[out] victim_seqno * \param[out] victim_seqno
// */
wsrep_status_t bf_abort(wsrep_seqno_t bf_seqno, wsrep_status_t bf_abort(wsrep_seqno_t bf_seqno,
wsrep_trx_id_t trx_id, wsrep_trx_id_t trx_id,
wsrep_seqno_t* victim_seqno) wsrep_seqno_t* victim_seqno)
@ -127,13 +136,11 @@ namespace trrep
return WSREP_OK; return WSREP_OK;
} }
int sst_sent(const wsrep_gtid_t&, int) { return 0; } /*!
int sst_received(const wsrep_gtid_t&, int) { return 0; } * \todo Inject an error so that the next call to any
* provider call will return the given error.
std::vector<status_variable> status() const */
{ void inject_error(wsrep_status_t);
return std::vector<status_variable>();
}
private: private:
wsrep_uuid_t group_id_; wsrep_uuid_t group_id_;
wsrep_uuid_t node_id_; wsrep_uuid_t node_id_;

View File

@ -189,6 +189,8 @@ int trrep::transaction_context::before_commit()
state() == s_committing || state() == s_committing ||
state() == s_must_abort || state() == s_must_abort ||
state() == s_replaying); state() == s_replaying);
assert((client_context_.mode() == trrep::client_context::m_replicating &&
state() == s_executing) || certified());
switch (client_context_.mode()) switch (client_context_.mode())
{ {