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

Address review comments

* Added unit tests for transaction::xa_detach() and
  transaction::xa_replay()
* Added unit tests for wsrep::xid
* Fixed minor issues pointed out by reviewer
This commit is contained in:
Daniele Sciascia
2020-09-30 17:48:53 +02:00
parent 39e37d3a39
commit 6752a4504f
12 changed files with 239 additions and 20 deletions

View File

@ -184,13 +184,13 @@ namespace wsrep
*/
virtual enum wsrep::provider::status commit_by_xid() = 0;
/*
Returns true if the client has an ongoing XA transaction.
This method is used to determine when to cleanup the
corresponding wsrep-lib transaction object.
This method should return false when the XA transaction
is over, and the wsrep-lib transaction object can be
cleaned up.
/**
* Returns true if the client has an ongoing XA transaction.
* This method is used to determine when to cleanup the
* corresponding wsrep-lib transaction object.
* This method should return false when the XA transaction
* is over, and the wsrep-lib transaction object can be
* cleaned up.
*/
virtual bool is_explicit_xa() = 0;

View File

@ -128,12 +128,7 @@ namespace wsrep
return !xid_.is_null();
}
void assign_xid(const wsrep::xid& xid)
{
assert(active());
assert(!is_xa());
xid_ = xid;
}
void assign_xid(const wsrep::xid& xid);
const wsrep::xid& xid() const
{

View File

@ -22,6 +22,7 @@
#include <iosfwd>
#include "buffer.hpp"
#include "exception.hpp"
namespace wsrep
{
@ -42,6 +43,10 @@ namespace wsrep
, bqual_len_(bqual_len)
, data_()
{
if (gtrid_len_ > 64 || bqual_len_ > 64)
{
throw wsrep::runtime_error("maximum wsrep::xid size exceeded");
}
const long len = gtrid_len_ + bqual_len_;
if (len > 0)
{
@ -64,6 +69,8 @@ namespace wsrep
void clear()
{
format_id_ = -1;
gtrid_len_ = 0;
bqual_len_ = 0;
data_.clear();
}