From a84112d30bc3fe6379f4ff6edd3d7aea107e3e50 Mon Sep 17 00:00:00 2001 From: Sreenath Bodagala Date: Wed, 6 Jul 2022 11:57:06 +0000 Subject: [PATCH] - Propagate the locality of the primary region from ClusterController to the sequencer, rather than deriving it from "MasterInterface" on the sequencer (which is not correct). --- fdbserver/ClusterRecovery.actor.cpp | 3 ++- fdbserver/include/fdbserver/MasterInterface.h | 16 +++++++++++++--- fdbserver/masterserver.actor.cpp | 9 +++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/fdbserver/ClusterRecovery.actor.cpp b/fdbserver/ClusterRecovery.actor.cpp index e1ef5ff10c..5cc4ce3743 100644 --- a/fdbserver/ClusterRecovery.actor.cpp +++ b/fdbserver/ClusterRecovery.actor.cpp @@ -999,7 +999,8 @@ ACTOR Future>> recruitEverything( self->lastEpochEnd, self->commitProxies, self->resolvers, - self->versionEpoch)))); + self->versionEpoch, + self->primaryLocality)))); return confChanges; } diff --git a/fdbserver/include/fdbserver/MasterInterface.h b/fdbserver/include/fdbserver/MasterInterface.h index f9c2c506ad..4cf4865a42 100644 --- a/fdbserver/include/fdbserver/MasterInterface.h +++ b/fdbserver/include/fdbserver/MasterInterface.h @@ -170,19 +170,29 @@ struct UpdateRecoveryDataRequest { std::vector resolvers; Optional versionEpoch; ReplyPromise reply; + int8_t primaryLocality; UpdateRecoveryDataRequest() = default; UpdateRecoveryDataRequest(Version recoveryTransactionVersion, Version lastEpochEnd, const std::vector& commitProxies, const std::vector& resolvers, - Optional versionEpoch) + Optional versionEpoch, + int8_t primaryLocality) : recoveryTransactionVersion(recoveryTransactionVersion), lastEpochEnd(lastEpochEnd), - commitProxies(commitProxies), resolvers(resolvers), versionEpoch(versionEpoch) {} + commitProxies(commitProxies), resolvers(resolvers), versionEpoch(versionEpoch), + primaryLocality(primaryLocality) {} template void serialize(Ar& ar) { - serializer(ar, recoveryTransactionVersion, lastEpochEnd, commitProxies, resolvers, versionEpoch, reply); + serializer(ar, + recoveryTransactionVersion, + lastEpochEnd, + commitProxies, + resolvers, + versionEpoch, + reply, + primaryLocality); } }; diff --git a/fdbserver/masterserver.actor.cpp b/fdbserver/masterserver.actor.cpp index 937045349a..5aa8337650 100644 --- a/fdbserver/masterserver.actor.cpp +++ b/fdbserver/masterserver.actor.cpp @@ -117,9 +117,7 @@ struct MasterData : NonCopyable, ReferenceCounted { forceRecovery = false; } balancer = resolutionBalancer.resolutionBalancing(); - locality = (SERVER_KNOBS->ENABLE_VERSION_VECTOR_HA_OPTIMIZATION && myInterface.locality.dcId().present()) - ? std::stoi(myInterface.locality.dcId().get().toString()) - : tagLocalityInvalid; + locality = tagLocalityInvalid; } ~MasterData() = default; }; @@ -324,7 +322,8 @@ ACTOR Future updateRecoveryData(Reference self) { .detail("CurrentRecoveryTxnVersion", self->recoveryTransactionVersion) .detail("CurrentLastEpochEnd", self->lastEpochEnd) .detail("NumCommitProxies", req.commitProxies.size()) - .detail("VersionEpoch", req.versionEpoch); + .detail("VersionEpoch", req.versionEpoch) + .detail("PrimaryLocality", req.primaryLocality); self->recoveryTransactionVersion = req.recoveryTransactionVersion; self->lastEpochEnd = req.lastEpochEnd; @@ -350,6 +349,8 @@ ACTOR Future updateRecoveryData(Reference self) { self->resolutionBalancer.setCommitProxies(req.commitProxies); self->resolutionBalancer.setResolvers(req.resolvers); + self->locality = req.primaryLocality; + req.reply.send(Void()); } }