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

Unnecessary adopt/start transaction in rollback_fragment()

This patch changes the handling of a rollback fragment so that
the high_priority_service adopts and starts a new transaction only
if fragment removal has to be performed.
When no fragment removal happens, starting a new transaction is
unnecessary: a dummy write set is logged instead and the transaction
is not cleaned up properly in DBMS side.
This commit is contained in:
Daniele Sciascia
2020-10-08 11:10:43 +02:00
parent 7245db4704
commit 2da6e4894e

View File

@ -216,12 +216,14 @@ static int rollback_fragment(wsrep::server_state& server_state,
const wsrep::ws_meta& ws_meta) const wsrep::ws_meta& ws_meta)
{ {
int ret(0); int ret(0);
// Adopts transaction state and starts a transaction for int adopt_error(0);
// high priority service bool const remove_fragments(streaming_applier->transaction().
int adopt_error; streaming_context().fragments().size() > 0);
bool remove_fragments(false); // If fragment removal is needed, adopt transaction state
if ((adopt_error = high_priority_service.adopt_transaction( // and start a transaction for it.
streaming_applier->transaction()))) if (remove_fragments &&
(adopt_error = high_priority_service.adopt_transaction(
streaming_applier->transaction())))
{ {
log_adopt_error(streaming_applier->transaction()); log_adopt_error(streaming_applier->transaction());
} }
@ -234,8 +236,6 @@ static int rollback_fragment(wsrep::server_state& server_state,
high_priority_service, *streaming_applier); high_priority_service, *streaming_applier);
// Streaming applier rolls back out of order. Fragment // Streaming applier rolls back out of order. Fragment
// removal grabs commit order below. // removal grabs commit order below.
remove_fragments = streaming_applier->transaction().
streaming_context().fragments().size() > 0;
ret = streaming_applier->rollback(wsrep::ws_handle(), wsrep::ws_meta()); ret = streaming_applier->rollback(wsrep::ws_handle(), wsrep::ws_meta());
ret = ret || (streaming_applier->after_apply(), 0); ret = ret || (streaming_applier->after_apply(), 0);
} }