From 8f490d431aef6d75f9a44bd396ff542a414114d1 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Mon, 3 Dec 2018 22:36:24 +0100 Subject: [PATCH] Undefined server id in convert_streaming_client_to_applier() Method wsrep::server_state::convert_streaming_client_to_applier() may insert an entry in streaming_appliers_ map which contains undefined server_id. This happens if the method is called while in non-primary state, and server_state::id_ is undefined. The fix is to use the server_id which is recorded in client's tansaction object. --- src/server_state.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server_state.cpp b/src/server_state.cpp index 2c8264f..48172d0 100644 --- a/src/server_state.cpp +++ b/src/server_state.cpp @@ -878,7 +878,8 @@ void wsrep::server_state::convert_streaming_client_to_applier( streaming_applier->adopt_transaction(client_state->transaction()); if (streaming_appliers_.insert( std::make_pair( - std::make_pair(id_, client_state->transaction().id()), + std::make_pair(client_state->transaction().server_id(), + client_state->transaction().id()), streaming_applier)).second == false) { wsrep::log_warning() << "Could not insert streaming applier " @@ -1110,10 +1111,12 @@ void wsrep::server_state::close_orphaned_sr_transactions( wsrep::gtid(), wsrep::stid(server_id, transaction_id, wsrep::client_id()), wsrep::seqno::undefined(), 0); + lock.unlock(); high_priority_service.remove_fragments(ws_meta); high_priority_service.commit(wsrep::ws_handle(transaction_id, 0), ws_meta); high_priority_service.after_apply(); + lock.lock(); } else {