1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-24 10:42:31 +03:00

Fixed dbsim replaying to conform current implementation

Inherited db::replayer_service from db::high_priority_service
and overrode after_apply() and is_replaying() methods to match
current state of library implementation. Changed
db::client_service::replay() to use db::replayer_service instead
of db::high_priority_service().
This commit is contained in:
Teemu Ollakka
2019-01-25 13:44:25 +02:00
parent fc5f59d27e
commit 9a32c72b48
3 changed files with 19 additions and 5 deletions

View File

@ -41,11 +41,11 @@ enum wsrep::provider::status
db::client_service::replay()
{
wsrep::high_priority_context high_priority_context(client_state_);
db::high_priority_service high_priority_service(
db::replayer_service replayer_service(
client_.server_, client_);
auto ret(client_state_.provider().replay(
client_state_.transaction().ws_handle(),
&high_priority_service));
&replayer_service));
if (ret == wsrep::provider::success)
{
++client_.stats_.replays;

View File

@ -108,5 +108,5 @@ int db::high_priority_service::log_dummy_write_set(
bool db::high_priority_service::is_replaying() const
{
return (client_.client_state_.transaction().state() == wsrep::transaction::s_replaying);
return false;
}

View File

@ -46,14 +46,14 @@ namespace db
int commit(const wsrep::ws_handle&, const wsrep::ws_meta&) override;
int rollback(const wsrep::ws_handle&, const wsrep::ws_meta&) override;
int apply_toi(const wsrep::ws_meta&, const wsrep::const_buffer&) override;
void after_apply() override;
virtual void after_apply() override;
void store_globals() override { }
void reset_globals() override { }
void switch_execution_context(wsrep::high_priority_service&) override
{ }
int log_dummy_write_set(const wsrep::ws_handle&,
const wsrep::ws_meta&) override;
bool is_replaying() const override;
virtual bool is_replaying() const override;
void debug_crash(const char*) override { }
private:
high_priority_service(const high_priority_service&);
@ -61,6 +61,20 @@ namespace db
db::server& server_;
db::client& client_;
};
class replayer_service : public db::high_priority_service
{
public:
replayer_service(db::server& server, db::client& client)
: db::high_priority_service(server, client)
{ }
// After apply is empty for replayer to keep the transaction
// context available for the client session after replaying
// is over.
void after_apply() override { }
bool is_replaying() const override { return true; }
};
}
#endif // WSREP_DB_HIGH_PRIORITY_SERVICE_HPP