Skip to content

Commit f0e2462

Browse files
committed
Changed background_rollback to return true/false depending on if
background rollback did happen. Background rollback should be skipped if the aborting happens due to KILL command issued by user. Some KILL signals, like KILL CONECTION, wake up the victim too early so that background rollback could happen in parallel with the victim waking up and continuing execution.
1 parent 5185ad3 commit f0e2462

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

dbsim/db_server_service.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ int db::server_service::start_sst(
8686
return 0;
8787
}
8888

89-
void db::server_service::background_rollback(wsrep::client_state&)
89+
bool db::server_service::background_rollback(wsrep::client_state&)
9090
{
91+
return false;
9192
}
9293

9394
void db::server_service::bootstrap()

dbsim/db_server_service.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace db
4141
bool sst_before_init() const override;
4242
int start_sst(const std::string&, const wsrep::gtid&, bool) override;
4343
std::string sst_request() override;
44-
void background_rollback(wsrep::client_state&) override;
44+
bool background_rollback(wsrep::client_state&) override;
4545
void bootstrap() override;
4646
void log_message(enum wsrep::log::level, const char* message) override;
4747
void log_dummy_write_set(wsrep::client_state&, const wsrep::ws_meta&)

include/wsrep/server_service.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ namespace wsrep
8686
/**
8787
* Perform a background rollback for a transaction.
8888
*/
89-
virtual void background_rollback(wsrep::client_state&) = 0;
89+
virtual bool background_rollback(wsrep::client_state&) = 0;
9090

9191
/**
9292
* Bootstrap a DBMS state for a new cluster.

src/transaction.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,9 @@ bool wsrep::transaction::bf_abort(
10741074
}
10751075

10761076
lock.unlock();
1077-
server_service_.background_rollback(client_state_);
1077+
/* if background rollback is skipped, reset rollbacker activity */
1078+
if (server_service_.background_rollback(client_state_))
1079+
client_state_.set_rollbacker_active(false);
10781080
lock.lock();
10791081
}
10801082
}

test/mock_server_state.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,12 @@ namespace wsrep
183183
return start_sst_action();
184184
}
185185

186-
void
186+
bool
187187
background_rollback(wsrep::client_state& client_state) WSREP_OVERRIDE
188188
{
189189
client_state.before_rollback();
190190
client_state.after_rollback();
191+
return false;
191192
}
192193

193194
int wait_committing_transactions(int) WSREP_OVERRIDE { return 0; }

0 commit comments

Comments
 (0)