1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-03 16:22:35 +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,24 +563,42 @@ 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 (v.state_id().id() != gtid.id() || /*
v.state_id().seqno() > gtid.seqno()) * 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)
{ {
/* Since IN GENERAL we may not be able to recover SST GTID from if (v.state_id().id() != gtid.id() ||
* the state data, we have to rely on SST script passing the GTID v.state_id().seqno() > gtid.seqno())
* value explicitly. {
* Here we check if the passed GTID makes any sense: it should /* Since IN GENERAL we may not be able to recover SST GTID from
* have the same UUID and greater or equal seqno than the last * the state data, we have to rely on SST script passing the
* logged view. */ * GTID value explicitly.
std::ostringstream msg; * Here we check if the passed GTID makes any sense: it should
msg << "SST script passed bogus GTID: " << gtid * have the same UUID and greater or equal seqno than the last
<< ". Preceeding view GTID: " << v.state_id(); * logged view. */
throw wsrep::runtime_error(msg.str()); std::ostringstream msg;
msg << "SST script passed bogus GTID: " << gtid
<< ". Preceeding view GTID: " << v.state_id();
throw wsrep::runtime_error(msg.str());
}
current_view_ = 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.";
} }
current_view_ = v;
server_service_.log_view(NULL /* this view is stored already */, v);
lock.lock(); lock.lock();
recover_streaming_appliers_if_not_recovered(lock, cs); recover_streaming_appliers_if_not_recovered(lock, cs);
lock.unlock(); lock.unlock();