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

Deal with backwards compatibility in sst_received()

Earlier versions of cluster software may not support storing
the view info into stable storage. In order to work around this
during rolling upgrade, skip sanity checks for recovered view
if the view state_id ID is undefined.
This commit is contained in:
Teemu Ollakka
2019-02-12 15:56:22 +02:00
parent 20b52ff1dd
commit 510c7f767f

View File

@ -563,12 +563,21 @@ void wsrep::server_state::sst_received(wsrep::client_service& cs,
wsrep::view const v(server_service_.get_view(cs, id_)); wsrep::view const v(server_service_.get_view(cs, id_));
wsrep::log_info() << "Recovered view from SST:\n" << v; wsrep::log_info() << "Recovered view from SST:\n" << v;
/*
* If the state id from recovered view has undefined ID, we may
* be upgrading from earlier version which does not provide
* view stored in stable storage. In this case we skip
* sanity checks and assigning the current view and wait
* until the first view delivery.
*/
if (v.state_id().id().is_undefined() == false)
{
if (v.state_id().id() != gtid.id() || if (v.state_id().id() != gtid.id() ||
v.state_id().seqno() > gtid.seqno()) v.state_id().seqno() > gtid.seqno())
{ {
/* Since IN GENERAL we may not be able to recover SST GTID from /* Since IN GENERAL we may not be able to recover SST GTID from
* the state data, we have to rely on SST script passing the GTID * the state data, we have to rely on SST script passing the
* value explicitly. * GTID value explicitly.
* Here we check if the passed GTID makes any sense: it should * Here we check if the passed GTID makes any sense: it should
* have the same UUID and greater or equal seqno than the last * have the same UUID and greater or equal seqno than the last
* logged view. */ * logged view. */
@ -580,7 +589,16 @@ void wsrep::server_state::sst_received(wsrep::client_service& cs,
current_view_ = v; current_view_ = v;
server_service_.log_view(NULL /* this view is stored already */, v); server_service_.log_view(NULL /* this view is stored already */, v);
}
else
{
wsrep::log_warning()
<< "View recovered from stable storage was empty. If the "
<< "server is doing rolling upgrade from previous version "
<< "which does not support storing view info into stable "
<< "storage, this is ok. Otherwise this may be a sign of "
<< "malfunction.";
}
lock.lock(); lock.lock();
recover_streaming_appliers_if_not_recovered(lock, cs); recover_streaming_appliers_if_not_recovered(lock, cs);
lock.unlock(); lock.unlock();