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

Execution context switching for high priority service.

This commit is contained in:
Teemu Ollakka
2018-07-09 11:35:20 +03:00
parent 95dbab4c08
commit 8a1e76bcec
10 changed files with 77 additions and 12 deletions

View File

@ -61,7 +61,8 @@ namespace
assert(server_state.find_streaming_applier(
ws_meta.server_id(), ws_meta.transaction_id()) == 0);
wsrep::high_priority_service* sa(
server_state.server_service().streaming_applier_service());
server_state.server_service().streaming_applier_service(
high_priority_service));
server_state.start_streaming_applier(
ws_meta.server_id(), ws_meta.transaction_id(), sa);
sa->start_transaction(ws_handle, ws_meta);
@ -84,14 +85,13 @@ namespace
// commit fragment comes in. Although this is a valid
// situation, log a warning if a sac cannot be found as
// it may be an indication of a bug too.
assert(0);
wsrep::log_warning() << "Could not find applier context for "
<< ws_meta.server_id()
<< ": " << ws_meta.transaction_id();
}
else
{
wsrep::high_priority_switch(high_priority_service, *sa);
wsrep::high_priority_switch sw(high_priority_service, *sa);
ret = sa->apply_write_set(data);
sa->after_apply();
}
@ -117,7 +117,6 @@ namespace
// commit fragment comes in. Although this is a valid
// situation, log a warning if a sac cannot be found as
// it may be an indication of a bug too.
assert(0);
wsrep::log_warning()
<< "Could not find applier context for "
<< ws_meta.server_id()
@ -125,9 +124,14 @@ namespace
}
else
{
wsrep::high_priority_switch(high_priority_service, *sa);
ret = sa->commit();
sa->after_apply();
// Make high priority switch to go out of scope
// before the streaming applier is released.
{
wsrep::high_priority_switch sw(
high_priority_service, *sa);
ret = sa->commit();
sa->after_apply();
}
server_state.stop_streaming_applier(
ws_meta.server_id(), ws_meta.transaction_id());
server_state.server_service().release_high_priority_service(sa);

View File

@ -1080,7 +1080,8 @@ void wsrep::transaction::streaming_rollback()
{
assert(streaming_context_.rolled_back() == false);
wsrep::high_priority_service* sa(
server_service_.streaming_applier_service());
server_service_.streaming_applier_service(
client_state_.client_service()));
client_state_.server_state().start_streaming_applier(
client_state_.server_state().id(), id(), sa);
sa->adopt_transaction(*this);