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

Interface changes required to store and remove fragments from high

priority context.
This commit is contained in:
Teemu Ollakka
2018-07-09 18:12:48 +03:00
parent 958a916b25
commit 6f68c70d37
10 changed files with 85 additions and 26 deletions

View File

@ -312,6 +312,12 @@ namespace wsrep
*/
void disable_streaming();
void fragment_applied(wsrep::seqno seqno)
{
assert(mode_ == m_high_priority);
transaction_.fragment_applied(seqno);
}
/**
* Prepare write set meta data for ordering.
* This method should be called before ordered commit or

View File

@ -48,19 +48,43 @@ namespace wsrep
* 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_write_set(const wsrep::const_buffer&) = 0;
/**
*
*/
virtual int append_fragment(const wsrep::ws_meta&,
const wsrep::const_buffer& data) = 0;
virtual int apply_write_set(const wsrep::ws_meta&,
const wsrep::const_buffer&) = 0;
/**
* Append a fragment into fragment storage. This will be
* called after a non-committing fragment belonging to
* streaming transaction has been applied. The call will
* not be done within an open transaction, the implementation
* must start a new transaction and commit.
*
* Note that the call is not done from streaming transaction
* context, but from applier context.
*/
virtual int append_fragment_and_commit(
const wsrep::ws_handle& ws_handle,
const wsrep::ws_meta& ws_meta,
const wsrep::const_buffer& data) = 0;
/**
* Remove fragments belonging to streaming transaction.
* This method will be called within the streaming transaction
* before commit. The implementation must not commit the
* whole transaction. The call will be done from streaming
* transaction context.
*
* @param ws_meta Write set meta data for commit fragment.
*
* @return Zero on success, non-zero on failure.
*/
virtual int remove_fragments(const wsrep::ws_meta& ws_meta) = 0;
/**
* Commit a transaction.
*/
virtual int commit(const wsrep::ws_handle&, const wsrep::ws_meta&) = 0;
/**
* Roll back a transaction
*/

View File

@ -52,6 +52,11 @@ namespace wsrep
bytes_certified_ += bytes;
}
void applied(wsrep::seqno seqno)
{
fragments_.push_back(seqno);
}
size_t fragments_certified() const
{
return fragments_.size();

View File

@ -87,6 +87,8 @@ namespace wsrep
int start_transaction(const wsrep::ws_handle& ws_handle,
const wsrep::ws_meta& ws_meta);
void fragment_applied(wsrep::seqno seqno);
int prepare_for_ordering(const wsrep::ws_handle& ws_handle,
const wsrep::ws_meta& ws_meta,
bool is_commit);