1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-22 23:21:53 +03:00

Added debug_crash() method to high priority service interface.

This commit is contained in:
Teemu Ollakka
2018-07-16 12:45:53 +03:00
parent 4418627f1b
commit 0efec1b8bd
4 changed files with 24 additions and 5 deletions

View File

@ -37,9 +37,10 @@ namespace db
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&) const wsrep::ws_meta&) override
{ return 0; } { return 0; }
bool is_replaying() const; bool is_replaying() const override;
void debug_crash(const char*) override { }
private: private:
high_priority_service(const high_priority_service&); high_priority_service(const high_priority_service&);
high_priority_service& operator=(const high_priority_service&); high_priority_service& operator=(const high_priority_service&);

View File

@ -169,6 +169,11 @@ namespace wsrep
virtual bool is_replaying() const = 0; virtual bool is_replaying() const = 0;
bool must_exit() const { return must_exit_; } bool must_exit() const { return must_exit_; }
/**
* Debug facility to crash the server at given point.
*/
virtual void debug_crash(const char* crash_point) = 0;
protected: protected:
wsrep::server_state& server_state_; wsrep::server_state& server_state_;
bool must_exit_; bool must_exit_;

View File

@ -44,11 +44,14 @@ static int apply_fragment(wsrep::server_state& server_state,
{ {
wsrep::high_priority_switch sw(high_priority_service, wsrep::high_priority_switch sw(high_priority_service,
streaming_applier); streaming_applier);
ret = streaming_applier.apply_write_set(ws_meta, data); ret = streaming_applier.apply_write_set(ws_meta, data);
streaming_applier.after_apply(); streaming_applier.after_apply();
} }
high_priority_service.debug_crash("crash_apply_cb_before_append_frag");
ret = ret || high_priority_service.append_fragment_and_commit( ret = ret || high_priority_service.append_fragment_and_commit(
ws_handle, ws_meta, data); ws_handle, ws_meta, data);
high_priority_service.debug_crash("crash_apply_cb_after_append_frag");
high_priority_service.after_apply(); high_priority_service.after_apply();
return ret; return ret;
} }
@ -67,9 +70,17 @@ static int commit_fragment(wsrep::server_state& server_state,
{ {
wsrep::high_priority_switch sw( wsrep::high_priority_switch sw(
high_priority_service, *streaming_applier); high_priority_service, *streaming_applier);
ret = streaming_applier->apply_write_set(ws_meta, data) || ret = streaming_applier->apply_write_set(ws_meta, data);
streaming_applier->remove_fragments(ws_meta) || streaming_applier->debug_crash(
streaming_applier->commit(ws_handle, ws_meta); "crash_apply_cb_before_fragment_removal");
ret = ret || streaming_applier->remove_fragments(ws_meta);
streaming_applier->debug_crash(
"crash_apply_cb_after_fragment_removal");
streaming_applier->debug_crash(
"crash_commit_cb_before_last_fragment_commit");
ret = ret || streaming_applier->commit(ws_handle, ws_meta);
streaming_applier->debug_crash(
"crash_commit_cb_last_fragment_commit_success");
streaming_applier->after_apply(); streaming_applier->after_apply();
} }
if (ret == 0) if (ret == 0)

View File

@ -57,6 +57,8 @@ namespace wsrep
const wsrep::ws_meta&) const wsrep::ws_meta&)
WSREP_OVERRIDE { return 0; } WSREP_OVERRIDE { return 0; }
bool is_replaying() const WSREP_OVERRIDE { return replaying_; } bool is_replaying() const WSREP_OVERRIDE { return replaying_; }
void debug_crash(const char*) WSREP_OVERRIDE { /* Not in unit tests*/}
wsrep::mock_client_state* client_state() wsrep::mock_client_state* client_state()
{ {
return client_state_; return client_state_;