Skip to content

Commit

Permalink
Refs codership/wsrep-API#21 added support for the IMPLICIT_DEPS WS flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ayurchen authored and sciascid committed Nov 28, 2018
1 parent 8ffad51 commit fd07ff1
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/wsrep/provider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ namespace wsrep
static const int native = (1 << 6);
static const int prepare = (1 << 7);
static const int snapshot = (1 << 8);
static const int implicit_deps = (1 << 9);
};

/**
Expand Down
4 changes: 4 additions & 0 deletions include/wsrep/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ namespace wsrep
bool pa_unsafe() const { return pa_unsafe_; }
void pa_unsafe(bool pa_unsafe) { pa_unsafe_ = pa_unsafe; }

bool implicit_deps() const { return implicit_deps_; }
void implicit_deps(bool implicit) { implicit_deps_ = implicit; }

int start_transaction(const wsrep::transaction_id& id);

int start_transaction(const wsrep::ws_handle& ws_handle,
Expand Down Expand Up @@ -204,6 +207,7 @@ namespace wsrep
wsrep::ws_meta ws_meta_;
int flags_;
bool pa_unsafe_;
bool implicit_deps_;
bool certified_;
wsrep::streaming_context streaming_context_;
wsrep::sr_key_set sr_keys_;
Expand Down
2 changes: 2 additions & 0 deletions src/provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ std::string wsrep::flags_to_string(int flags)
oss << "prepare | ";
if (flags & provider::flag::snapshot)
oss << "snapshot | ";
if (flags & provider::flag::implicit_deps)
oss << "implicit_deps | ";

std::string ret(oss.str());
if (ret.size() > 3) ret.erase(ret.size() - 3);
Expand Down
12 changes: 12 additions & 0 deletions src/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ wsrep::transaction::transaction(
, ws_meta_()
, flags_()
, pa_unsafe_(false)
, implicit_deps_(false)
, certified_(false)
, streaming_context_()
, sr_keys_()
Expand Down Expand Up @@ -1061,6 +1062,11 @@ int wsrep::transaction::certify_fragment(
client_state_.server_state_.start_streaming_client(&client_state_);
}

if (implicit_deps())
{
flags(flags() | wsrep::provider::flag::implicit_deps);
}

int ret(0);
enum wsrep::client_error error(wsrep::e_success);
enum wsrep::provider::status cert_ret(wsrep::provider::success);
Expand Down Expand Up @@ -1241,6 +1247,11 @@ int wsrep::transaction::certify_commit(
flags(flags() | wsrep::provider::flag::pa_unsafe);
}

if (implicit_deps())
{
flags(flags() | wsrep::provider::flag::implicit_deps);
}

flags(flags() | wsrep::provider::flag::commit);

if (client_service_.prepare_data_for_replication())
Expand Down Expand Up @@ -1472,6 +1483,7 @@ void wsrep::transaction::cleanup()
flags_ = 0;
certified_ = false;
pa_unsafe_ = false;
implicit_deps_ = false;
sr_keys_.clear();
streaming_context_.cleanup();
client_service_.cleanup_transaction();
Expand Down
10 changes: 8 additions & 2 deletions src/wsrep_provider_v26.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ namespace
WSREP_FLAG_TRX_PREPARE) |
map_one(flags,
provider::flag::snapshot,
WSREP_FLAG_SNAPSHOT));
WSREP_FLAG_SNAPSHOT) |
map_one(flags,
provider::flag::implicit_deps,
WSREP_FLAG_IMPLICIT_DEPS));
}

int map_flags_from_native(uint32_t flags)
Expand Down Expand Up @@ -153,7 +156,10 @@ namespace
provider::flag::prepare) |
map_one(flags,
WSREP_FLAG_SNAPSHOT,
provider::flag::snapshot));
provider::flag::snapshot) |
map_one(flags,
WSREP_FLAG_IMPLICIT_DEPS,
provider::flag::implicit_deps));
}

class mutable_ws_handle
Expand Down
2 changes: 1 addition & 1 deletion wsrep-API/v26
Submodule v26 updated 1 files
+21 −18 wsrep_api.h

0 comments on commit fd07ff1

Please sign in to comment.