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

Implemented SR transaction rollback.

This commit is contained in:
Teemu Ollakka
2018-07-10 14:01:41 +03:00
parent e916453e6d
commit 80ca03daaf
17 changed files with 362 additions and 91 deletions

View File

@ -434,11 +434,17 @@ namespace wsrep
return transaction_.start_replaying(ws_meta);
}
/**
* Adopt a streaming transaction state. This is must be
* called from high_priority_service::adopt_transaction()
* during streaming transaction rollback. The call will
* set up enough context for handling the rollback
* fragment.
*/
void adopt_transaction(const wsrep::transaction& transaction)
{
assert(mode_ == m_high_priority);
transaction_.start_transaction(transaction.id());
transaction_.streaming_context() = transaction.streaming_context();
transaction_.adopt(transaction);
}
/** @name Non-transactional operations */

View File

@ -36,6 +36,12 @@ namespace wsrep
virtual int start_transaction(const wsrep::ws_handle&,
const wsrep::ws_meta&) = 0;
/**
* Return transaction object associated to high priority
* service state.
*/
virtual const wsrep::transaction& transaction() const = 0;
/**
* Adopt a transaction.
*/
@ -83,8 +89,18 @@ namespace wsrep
/**
* Commit a transaction.
* An implementation must call
* wsrep::client_state::prepare_for_ordering() to set
* the ws_handle and ws_meta before the commit if the
* commit process will go through client state commit
* processing. Otherwise the implementation must release
* commit order explicitly via provider.
*
* @param ws_handle Write set handle
* @param ws_meta Write set meta
*/
virtual int commit(const wsrep::ws_handle&, const wsrep::ws_meta&) = 0;
virtual int commit(const wsrep::ws_handle& ws_handle,
const wsrep::ws_meta& ws_meta) = 0;
/**
* Roll back a transaction
*/

View File

@ -8,6 +8,8 @@
#include "exception.hpp"
#include "buffer.hpp"
#include <iosfwd>
namespace wsrep
{
class key
@ -60,6 +62,7 @@ namespace wsrep
typedef std::vector<wsrep::key> key_array;
std::ostream& operator<<(std::ostream&, const wsrep::key&);
}
#endif // WSREP_KEY_HPP

View File

@ -262,7 +262,7 @@ namespace wsrep
virtual enum status bf_abort(wsrep::seqno bf_seqno,
wsrep::transaction_id victim_trx,
wsrep::seqno& victim_seqno) = 0;
virtual int rollback(wsrep::transaction_id) = 0;
virtual enum status rollback(wsrep::transaction_id) = 0;
virtual enum status commit_order_enter(const wsrep::ws_handle&,
const wsrep::ws_meta&) = 0;
virtual int commit_order_leave(const wsrep::ws_handle&,

View File

@ -88,6 +88,7 @@ namespace wsrep
int start_transaction(const wsrep::ws_handle& ws_handle,
const wsrep::ws_meta& ws_meta);
void adopt(const transaction& transaction);
void fragment_applied(wsrep::seqno seqno);
int prepare_for_ordering(const wsrep::ws_handle& ws_handle,
@ -155,6 +156,7 @@ namespace wsrep
void clear_fragments();
void cleanup();
void debug_log_state(const char*) const;
void debug_log_key_append(const wsrep::key& key);
wsrep::server_service& server_service_;
wsrep::client_service& client_service_;