- 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).
This commit is contained in:
Sreenath Bodagala 2022-07-06 11:57:06 +00:00
parent b9afde3d4c
commit a84112d30b
3 changed files with 20 additions and 8 deletions

View File

@ -999,7 +999,8 @@ ACTOR Future<std::vector<Standalone<CommitTransactionRef>>> recruitEverything(
self->lastEpochEnd,
self->commitProxies,
self->resolvers,
self->versionEpoch))));
self->versionEpoch,
self->primaryLocality))));
return confChanges;
}

View File

@ -170,19 +170,29 @@ struct UpdateRecoveryDataRequest {
std::vector<ResolverInterface> resolvers;
Optional<int64_t> versionEpoch;
ReplyPromise<Void> reply;
int8_t primaryLocality;
UpdateRecoveryDataRequest() = default;
UpdateRecoveryDataRequest(Version recoveryTransactionVersion,
Version lastEpochEnd,
const std::vector<CommitProxyInterface>& commitProxies,
const std::vector<ResolverInterface>& resolvers,
Optional<int64_t> versionEpoch)
Optional<int64_t> versionEpoch,
int8_t primaryLocality)
: recoveryTransactionVersion(recoveryTransactionVersion), lastEpochEnd(lastEpochEnd),
commitProxies(commitProxies), resolvers(resolvers), versionEpoch(versionEpoch) {}
commitProxies(commitProxies), resolvers(resolvers), versionEpoch(versionEpoch),
primaryLocality(primaryLocality) {}
template <class Ar>
void serialize(Ar& ar) {
serializer(ar, recoveryTransactionVersion, lastEpochEnd, commitProxies, resolvers, versionEpoch, reply);
serializer(ar,
recoveryTransactionVersion,
lastEpochEnd,
commitProxies,
resolvers,
versionEpoch,
reply,
primaryLocality);
}
};

View File

@ -117,9 +117,7 @@ struct MasterData : NonCopyable, ReferenceCounted<MasterData> {
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<Void> updateRecoveryData(Reference<MasterData> 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<Void> updateRecoveryData(Reference<MasterData> self) {
self->resolutionBalancer.setCommitProxies(req.commitProxies);
self->resolutionBalancer.setResolvers(req.resolvers);
self->locality = req.primaryLocality;
req.reply.send(Void());
}
}