mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-06-04 09:02:12 +03:00
Allow storage service implementation to run in client context
If the storage service implementation can operate in client session context, avoid resetting/restoring globals when changing to storage service scope in transaction.cpp.
This commit is contained in:
parent
3d998f9ad6
commit
13e9403eba
@ -92,6 +92,17 @@ namespace wsrep
|
||||
|
||||
virtual void store_globals() = 0;
|
||||
virtual void reset_globals() = 0;
|
||||
|
||||
/**
|
||||
* Return true if the implementation requires storing
|
||||
* and restoring global state. Return true by default
|
||||
* since this is the original behavior. Stateless
|
||||
* implementations may override.
|
||||
*/
|
||||
virtual bool requires_globals() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -63,8 +63,10 @@ namespace
|
||||
{
|
||||
throw wsrep::runtime_error("Null client_state provided");
|
||||
}
|
||||
client_service_.reset_globals();
|
||||
storage_service_->store_globals();
|
||||
if (storage_service_->requires_globals()) {
|
||||
client_service_.reset_globals();
|
||||
storage_service_->store_globals();
|
||||
}
|
||||
}
|
||||
|
||||
wsrep::storage_service& storage_service()
|
||||
@ -74,8 +76,11 @@ namespace
|
||||
|
||||
~scoped_storage_service()
|
||||
{
|
||||
bool restore_globals = storage_service_->requires_globals();
|
||||
deleter_(storage_service_);
|
||||
client_service_.store_globals();
|
||||
if (restore_globals) {
|
||||
client_service_.store_globals();
|
||||
}
|
||||
}
|
||||
private:
|
||||
scoped_storage_service(const scoped_storage_service&);
|
||||
|
Loading…
x
Reference in New Issue
Block a user