mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-25 21:41:56 +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:
@ -41,11 +41,11 @@ enum wsrep::provider::status
|
|||||||
db::client_service::replay()
|
db::client_service::replay()
|
||||||
{
|
{
|
||||||
wsrep::high_priority_context high_priority_context(client_state_);
|
wsrep::high_priority_context high_priority_context(client_state_);
|
||||||
db::high_priority_service high_priority_service(
|
db::replayer_service replayer_service(
|
||||||
client_.server_, client_);
|
client_.server_, client_);
|
||||||
auto ret(client_state_.provider().replay(
|
auto ret(client_state_.provider().replay(
|
||||||
client_state_.transaction().ws_handle(),
|
client_state_.transaction().ws_handle(),
|
||||||
&high_priority_service));
|
&replayer_service));
|
||||||
if (ret == wsrep::provider::success)
|
if (ret == wsrep::provider::success)
|
||||||
{
|
{
|
||||||
++client_.stats_.replays;
|
++client_.stats_.replays;
|
||||||
|
@ -108,5 +108,5 @@ int db::high_priority_service::log_dummy_write_set(
|
|||||||
|
|
||||||
bool db::high_priority_service::is_replaying() const
|
bool db::high_priority_service::is_replaying() const
|
||||||
{
|
{
|
||||||
return (client_.client_state_.transaction().state() == wsrep::transaction::s_replaying);
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -46,14 +46,14 @@ namespace db
|
|||||||
int commit(const wsrep::ws_handle&, const wsrep::ws_meta&) override;
|
int commit(const wsrep::ws_handle&, const wsrep::ws_meta&) override;
|
||||||
int rollback(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;
|
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 store_globals() override { }
|
||||||
void reset_globals() override { }
|
void reset_globals() override { }
|
||||||
void switch_execution_context(wsrep::high_priority_service&) override
|
void switch_execution_context(wsrep::high_priority_service&) override
|
||||||
{ }
|
{ }
|
||||||
int log_dummy_write_set(const wsrep::ws_handle&,
|
int log_dummy_write_set(const wsrep::ws_handle&,
|
||||||
const wsrep::ws_meta&) override;
|
const wsrep::ws_meta&) override;
|
||||||
bool is_replaying() const override;
|
virtual bool is_replaying() const override;
|
||||||
void debug_crash(const char*) override { }
|
void debug_crash(const char*) override { }
|
||||||
private:
|
private:
|
||||||
high_priority_service(const high_priority_service&);
|
high_priority_service(const high_priority_service&);
|
||||||
@ -61,6 +61,20 @@ namespace db
|
|||||||
db::server& server_;
|
db::server& server_;
|
||||||
db::client& client_;
|
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
|
#endif // WSREP_DB_HIGH_PRIORITY_SERVICE_HPP
|
||||||
|
Reference in New Issue
Block a user