mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-08-08 02:02:57 +03:00
Provider write set handle and meta data for high priority commit
The write set handle and meta data are needed for SR transactions where the commit context is not known when the transaction starts. The passed handle and meta data can be set through client_state prepare_for_ordering() call before performing commit.
This commit is contained in:
@@ -46,7 +46,7 @@ namespace
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
else if (high_priority_service.commit())
|
||||
else if (high_priority_service.commit(ws_handle, ws_meta))
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ namespace
|
||||
if (high_priority_service.is_replaying())
|
||||
{
|
||||
ret = high_priority_service.apply_write_set(data) ||
|
||||
high_priority_service.commit();
|
||||
high_priority_service.commit(ws_handle, ws_meta);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -129,7 +129,7 @@ namespace
|
||||
{
|
||||
wsrep::high_priority_switch sw(
|
||||
high_priority_service, *sa);
|
||||
ret = sa->commit();
|
||||
ret = sa->commit(ws_handle, ws_meta);
|
||||
sa->after_apply();
|
||||
}
|
||||
server_state.stop_streaming_applier(
|
||||
|
@@ -134,9 +134,10 @@ int wsrep::transaction::start_transaction(
|
||||
const wsrep::ws_handle& ws_handle,
|
||||
const wsrep::ws_meta& ws_meta)
|
||||
{
|
||||
debug_log_state("start_transaction enter");
|
||||
if (state() != s_replaying)
|
||||
{
|
||||
assert(ws_meta.flags());
|
||||
// assert(ws_meta.flags());
|
||||
assert(active() == false);
|
||||
id_ = ws_meta.transaction_id();
|
||||
assert(client_state_.mode() == wsrep::client_state::m_high_priority);
|
||||
@@ -150,6 +151,7 @@ int wsrep::transaction::start_transaction(
|
||||
{
|
||||
start_replaying(ws_meta);
|
||||
}
|
||||
debug_log_state("start_transaction leave");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -553,6 +555,7 @@ int wsrep::transaction::after_statement()
|
||||
int ret(0);
|
||||
wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex());
|
||||
debug_log_state("after_statement_enter");
|
||||
assert(client_state_.mode() == wsrep::client_state::m_local);
|
||||
assert(state() == s_executing ||
|
||||
state() == s_committed ||
|
||||
state() == s_aborted ||
|
||||
@@ -669,6 +672,23 @@ void wsrep::transaction::after_applying()
|
||||
assert(state_ == s_executing ||
|
||||
state_ == s_committed ||
|
||||
state_ == s_aborted);
|
||||
|
||||
// We may enter here from either high priority applier or
|
||||
// from fragment storage service. High priority applier
|
||||
// should always have set up meta data for ordering, but
|
||||
// fragment storage service operation may be rolled back
|
||||
// before the fragment is ordered and certified.
|
||||
// Therefore we need to check separately if the ordering has
|
||||
// been done.
|
||||
if (state_ == s_aborted && ordered())
|
||||
{
|
||||
int ret(provider().commit_order_enter(ws_handle_, ws_meta_));
|
||||
if (ret == 0)
|
||||
{
|
||||
provider().commit_order_leave(ws_handle_, ws_meta_);
|
||||
}
|
||||
}
|
||||
|
||||
if (state_ != s_executing)
|
||||
{
|
||||
cleanup();
|
||||
|
Reference in New Issue
Block a user