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

Add prepare flag to wsrep::provider::flag

This commit is contained in:
Daniele Sciascia
2018-10-24 09:23:36 +02:00
committed by Teemu Ollakka
parent cf434f3da5
commit ed7c4d7410
3 changed files with 37 additions and 9 deletions

View File

@ -217,7 +217,8 @@ namespace wsrep
static const int pa_unsafe = (1 << 4);
static const int commutative = (1 << 5);
static const int native = (1 << 6);
static const int snapshot = (1 << 7);
static const int prepare = (1 << 7);
static const int snapshot = (1 << 8);
};
/**
@ -378,6 +379,11 @@ namespace wsrep
return (flags & wsrep::provider::flag::rollback);
}
static inline bool prepares_transaction(int flags)
{
return (flags & wsrep::provider::flag::prepare);
}
static inline bool is_toi(int flags)
{
return (flags & wsrep::provider::flag::isolation);

View File

@ -62,6 +62,8 @@ std::string wsrep::flags_to_string(int flags)
oss << "isolation | ";
if (flags & provider::flag::pa_unsafe)
oss << "pa_unsafe | ";
if (flags & provider::flag::prepare)
oss << "prepare | ";
if (flags & provider::flag::snapshot)
oss << "snapshot | ";

View File

@ -92,6 +92,7 @@ namespace
{
return wsrep::seqno(seqno);
}
template <typename F, typename T>
inline uint32_t map_one(const int flags, const F from,
const T to)
@ -102,15 +103,29 @@ namespace
uint32_t map_flags_to_native(int flags)
{
using wsrep::provider;
return (map_one(flags, provider::flag::start_transaction,
return (map_one(flags,
provider::flag::start_transaction,
WSREP_FLAG_TRX_START) |
map_one(flags, provider::flag::commit, WSREP_FLAG_TRX_END) |
map_one(flags, provider::flag::rollback, WSREP_FLAG_ROLLBACK) |
map_one(flags, provider::flag::isolation, WSREP_FLAG_ISOLATION) |
map_one(flags, provider::flag::pa_unsafe, WSREP_FLAG_PA_UNSAFE) |
map_one(flags,
provider::flag::commit,
WSREP_FLAG_TRX_END) |
map_one(flags,
provider::flag::rollback,
WSREP_FLAG_ROLLBACK) |
map_one(flags,
provider::flag::isolation,
WSREP_FLAG_ISOLATION) |
map_one(flags,
provider::flag::pa_unsafe,
WSREP_FLAG_PA_UNSAFE) |
// map_one(flags, provider::flag::commutative, WSREP_FLAG_COMMUTATIVE) |
// map_one(flags, provider::flag::native, WSREP_FLAG_NATIVE) |
map_one(flags, provider::flag::snapshot, WSREP_FLAG_SNAPSHOT));
map_one(flags,
provider::flag::prepare,
WSREP_FLAG_TRX_PREPARE) |
map_one(flags,
provider::flag::snapshot,
WSREP_FLAG_SNAPSHOT));
}
int map_flags_from_native(uint32_t flags)
@ -133,7 +148,12 @@ namespace
provider::flag::pa_unsafe) |
// map_one(flags, provider::flag::commutative, WSREP_FLAG_COMMUTATIVE) |
// map_one(flags, provider::flag::native, WSREP_FLAG_NATIVE) |
map_one(flags, WSREP_FLAG_SNAPSHOT, provider::flag::snapshot));
map_one(flags,
WSREP_FLAG_TRX_PREPARE,
provider::flag::prepare) |
map_one(flags,
WSREP_FLAG_SNAPSHOT,
provider::flag::snapshot));
}
class mutable_ws_handle