mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-28 20:02:00 +03:00
Split commit_or_rollback_by_xid()
in two methods
Split `client_state::commit_or_rollback_by_xid()` into `client_state::commit_by_xid()` and `client_state::rollback_by_xid()`.
This commit is contained in:
@ -550,22 +550,39 @@ namespace wsrep
|
||||
}
|
||||
|
||||
/**
|
||||
* Terminate transaction with the given xid
|
||||
* Commit 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.
|
||||
* Sends a commit fragment to terminate the 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
|
||||
* @param xid the xid of the the transaction to commit
|
||||
*
|
||||
* @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)
|
||||
int commit_by_xid(const std::string& xid)
|
||||
{
|
||||
return transaction_.commit_or_rollback_by_xid(xid, commit);
|
||||
return transaction_.commit_or_rollback_by_xid(xid, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rollback transaction with the given xid
|
||||
*
|
||||
* Sends a rollback fragment to terminate the 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 commit
|
||||
*
|
||||
* @return Zero on success, non-zero on error. In case of error
|
||||
* the client_state's current_error is set
|
||||
*/
|
||||
int rollback_by_xid(const std::string& xid)
|
||||
{
|
||||
return transaction_.commit_or_rollback_by_xid(xid, false);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1209,14 +1209,14 @@ int wsrep::transaction::streaming_step(wsrep::unique_lock<wsrep::mutex>& lock,
|
||||
assert(streaming_context_.fragment_size() || is_xa());
|
||||
|
||||
if (client_service_.bytes_generated() <
|
||||
streaming_context_.bytes_certified())
|
||||
streaming_context_.log_position())
|
||||
{
|
||||
/* Something went wrong on DBMS side in keeping track of
|
||||
generated bytes. Return an error to abort the transaction. */
|
||||
wsrep::log_warning() << "Bytes generated "
|
||||
<< client_service_.bytes_generated()
|
||||
<< " less than bytes certified "
|
||||
<< streaming_context_.bytes_certified()
|
||||
<< streaming_context_.log_position()
|
||||
<< ", aborting streaming transaction";
|
||||
return 1;
|
||||
}
|
||||
|
Submodule wsrep-API/v26 updated: 75a5f452f2...35b9ecedd8
Reference in New Issue
Block a user