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

TOI replicating and applying codepaths

This commit is contained in:
Teemu Ollakka
2018-06-25 09:28:51 +03:00
parent 6a369a5d0e
commit cad9176474
11 changed files with 324 additions and 169 deletions

View File

@ -81,8 +81,23 @@ namespace wsrep
/**
* Apply a write set.
*
* A write set applying happens always
* as a part of the transaction. The caller must start a
* new transaction before applying a write set and must
* either commit to make changes persistent or roll back.
*/
virtual int apply(const wsrep::const_buffer&) = 0;
virtual int apply_write_set(const wsrep::const_buffer&) = 0;
/**
* Apply a TOI operation.
*
* TOI operation is a standalone operation and should not
* be executed as a part of a transaction.
*/
virtual int apply_toi(const wsrep::const_buffer&) = 0;
//
// Interface to global server state
//

View File

@ -399,6 +399,7 @@ namespace wsrep
/**
* Enter total order isolation critical section.
*
* @param key_array Array of keys
* @param buffer Buffer containing the action to execute inside
* total order isolation section
@ -409,7 +410,30 @@ namespace wsrep
int enter_toi(const wsrep::key_array& key_array,
const wsrep::const_buffer& buffer,
int flags);
/**
* Enter applying total order critical section.
*
* @param ws_meta Write set meta data
*/
int enter_toi(const wsrep::ws_meta& ws_meta);
/**
* Return true if the client_state is under TOI operation.
*/
bool in_toi() const
{
return (toi_meta_.seqno().is_undefined() == false);
}
/**
* Return the mode where client entered into TOI mode.
* The return value can be either m_replicating or
* m_high_priority.
*/
enum mode toi_mode() const
{
return toi_mode_;
}
/**
* Leave total order isolation critical section.
*/
@ -556,6 +580,7 @@ namespace wsrep
, client_service_(client_service)
, id_(id)
, mode_(mode)
, toi_mode_()
, state_(s_none)
, transaction_(*this)
, toi_meta_()
@ -585,6 +610,7 @@ namespace wsrep
wsrep::client_service& client_service_;
wsrep::client_id id_;
enum mode mode_;
enum mode toi_mode_;
enum state state_;
wsrep::transaction transaction_;
wsrep::ws_meta toi_meta_;

View File

@ -344,7 +344,20 @@ namespace wsrep
return (flags & wsrep::provider::flag::rollback);
}
static inline bool is_toi(int flags)
{
return (flags & wsrep::provider::flag::isolation);
}
static inline bool is_commutative(int flags)
{
return (flags & wsrep::provider::flag::commutative);
}
static inline bool is_native(int flags)
{
return (flags & wsrep::provider::flag::native);
}
}
#endif // WSREP_PROVIDER_HPP