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

Make recover_streaming_appliers_if_not_recovered() public

The method is needed by GRP provider to recover SR transactions
after becoming connected to the cluster. The SST code path does
not get always executed, and the view change hander is too late
in codepath as the GRP may start applying events without
delivering primary view first.
This commit is contained in:
Teemu Ollakka
2023-09-18 16:01:59 +03:00
parent a7ce22ac91
commit 26434e4fc8
3 changed files with 23 additions and 8 deletions

View File

@ -536,6 +536,19 @@ namespace wsrep
return init_initialized_; return init_initialized_;
} }
/** Recover streaming appliers if not already recoverd yet.
*
* This method recovers streaming appliers from streaming log.
* It must be called before starting to apply events after
* connecting to the cluster.
*
* @param lock Lock object holding server_state mutex.
* @param service Either client or high priority service.
*/
template <class C>
void recover_streaming_appliers_if_not_recovered(
wsrep::unique_lock<wsrep::mutex>& lock, C& service);
/** /**
* This method will be called by the provider when * This method will be called by the provider when
* a remote write set is being applied. It is the responsibility * a remote write set is being applied. It is the responsibility
@ -653,11 +666,7 @@ namespace wsrep
// Interrupt all threads which are waiting for state // Interrupt all threads which are waiting for state
void interrupt_state_waiters(wsrep::unique_lock<wsrep::mutex>&); void interrupt_state_waiters(wsrep::unique_lock<wsrep::mutex>&);
// Recover streaming appliers if not already recoverd private:
template <class C>
void recover_streaming_appliers_if_not_recovered(
wsrep::unique_lock<wsrep::mutex>&, C&);
// Close SR transcations whose origin is outside of current // Close SR transcations whose origin is outside of current
// cluster view. // cluster view.
void close_orphaned_sr_transactions( void close_orphaned_sr_transactions(

View File

@ -307,7 +307,8 @@ static int apply_write_set(wsrep::server_state& server_state,
wsrep::log::debug_level_server_state, wsrep::log::debug_level_server_state,
"Could not find applier context for " "Could not find applier context for "
<< ws_meta.server_id() << ws_meta.server_id()
<< ": " << ws_meta.transaction_id()); << ": " << ws_meta.transaction_id()
<< ", " << ws_meta.seqno());
ret = high_priority_service.log_dummy_write_set( ret = high_priority_service.log_dummy_write_set(
ws_handle, ws_meta, no_error); ws_handle, ws_meta, no_error);
} }
@ -379,7 +380,8 @@ static int apply_write_set(wsrep::server_state& server_state,
// it may be an indication of a bug too. // it may be an indication of a bug too.
wsrep::log_warning() << "Could not find applier context for " wsrep::log_warning() << "Could not find applier context for "
<< ws_meta.server_id() << ws_meta.server_id()
<< ": " << ws_meta.transaction_id(); << ": " << ws_meta.transaction_id()
<< ", " << ws_meta.seqno();
wsrep::mutable_buffer no_error; wsrep::mutable_buffer no_error;
ret = high_priority_service.log_dummy_write_set( ret = high_priority_service.log_dummy_write_set(
ws_handle, ws_meta, no_error); ws_handle, ws_meta, no_error);
@ -420,7 +422,8 @@ static int apply_write_set(wsrep::server_state& server_state,
wsrep::log_warning() wsrep::log_warning()
<< "Could not find applier context for " << "Could not find applier context for "
<< ws_meta.server_id() << ws_meta.server_id()
<< ": " << ws_meta.transaction_id(); << ": " << ws_meta.transaction_id()
<< ", " << ws_meta.seqno();
wsrep::mutable_buffer no_error; wsrep::mutable_buffer no_error;
ret = high_priority_service.log_dummy_write_set( ret = high_priority_service.log_dummy_write_set(
ws_handle, ws_meta, no_error); ws_handle, ws_meta, no_error);

View File

@ -1134,6 +1134,9 @@ wsrep::wsrep_provider_v26::status() const
} }
wsrep_->stats_free(wsrep_, stats); wsrep_->stats_free(wsrep_, stats);
} }
std::ostringstream id_os;
id_os << server_state_.id();
ret.push_back(status_variable{"own_id", id_os.str()});
return ret; return ret;
} }