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

Minimize client_service interface for XA

Remove methods `is_xa()`, `is_xa_prepare()`, and `xid()` from
client_service interface. Instead, transactions are explicitly
assigned their xid, through at start of XA.
This commit is contained in:
Daniele Sciascia
2019-07-30 11:25:38 +02:00
parent 052247144f
commit 5d18ce3e75
7 changed files with 85 additions and 126 deletions

View File

@ -305,36 +305,6 @@ namespace wsrep
return transaction_.assign_read_view(gtid);
}
/**
* Restores the client's transaction to prepared state
*
* The purpose of this method is to restore transaction state
* during recovery of a prepared XA transaction.
*/
int restore_prepared_transaction()
{
return transaction_.restore_to_prepared_state();
}
/**
* Terminate transaction with the given xid
*
* Sends a commit or rollback fragment to terminate the a
* transaction with the given xid. For the fragment to be
* sent, a streaming applier for the transaction must exist
* and the transaction must be in prepared state.
*
* @param xid the xid of the the transaction to terminate
* @param commit whether to send a commmit or rollback fragment
*
* @return Zero on success, non-zero on error. In case of error
* the client_state's current_error is set
*/
int commit_or_rollback_by_xid(const std::string& xid, bool commit)
{
return transaction_.commit_or_rollback_by_xid(xid, commit);
}
/**
* Append a key into transaction write set.
*
@ -552,6 +522,52 @@ namespace wsrep
void wait_rollback_complete_and_acquire_ownership();
/** @} */
//
// XA
//
/**
* Assign transaction external id.
*
* Other than storing the xid, the transaction is marked as XA.
* This should be called when XA transaction is started.
*
* @param xid transaction id
*/
void assign_xid(const std::string& xid)
{
transaction_.assign_xid(xid);
}
/**
* Restores the client's transaction to prepared state
*
* The purpose of this method is to restore transaction state
* during recovery of a prepared XA transaction.
*/
int restore_xid(std::string& xid)
{
return transaction_.restore_to_prepared_state(xid);
}
/**
* Terminate transaction with the given xid
*
* Sends a commit or rollback fragment to terminate a
* transaction with the given xid. For the fragment to be
* sent, a streaming applier for the transaction must exist
* and the transaction must be in prepared state.
*
* @param xid the xid of the the transaction to terminate
* @param commit whether to send a commmit or rollback fragment
*
* @return Zero on success, non-zero on error. In case of error
* the client_state's current_error is set
*/
int commit_or_rollback_by_xid(const std::string& xid, bool commit)
{
return transaction_.commit_or_rollback_by_xid(xid, commit);
}
//
// BF aborting
//