MCPcopy Create free account
hub / github.com/apple/foundationdb / clusterRegisterMaster

Function clusterRegisterMaster

fdbserver/ClusterController.actor.cpp:932–1062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

930}
931
932void clusterRegisterMaster(ClusterControllerData* self, RegisterMasterRequest const& req) {
933 req.reply.send(Void());
934
935 TraceEvent("MasterRegistrationReceived", self->id)
936 .detail("MasterId", req.id)
937 .detail("Master", req.mi.toString())
938 .detail("Tlogs", describe(req.logSystemConfig.tLogs))
939 .detail("Resolvers", req.resolvers.size())
940 .detail("RecoveryState", (int)req.recoveryState)
941 .detail("RegistrationCount", req.registrationCount)
942 .detail("CommitProxies", req.commitProxies.size())
943 .detail("GrvProxies", req.grvProxies.size())
944 .detail("RecoveryCount", req.recoveryCount)
945 .detail("Stalled", req.recoveryStalled)
946 .detail("OldestBackupEpoch", req.logSystemConfig.oldestBackupEpoch)
947 .detail("ClusterId", req.clusterId);
948
949 // make sure the request comes from an active database
950 auto db = &self->db;
951 if (db->serverInfo->get().master.id() != req.id || req.registrationCount <= db->masterRegistrationCount) {
952 TraceEvent("MasterRegistrationNotFound", self->id)
953 .detail("MasterId", req.id)
954 .detail("ExistingId", db->serverInfo->get().master.id())
955 .detail("RegCount", req.registrationCount)
956 .detail("ExistingRegCount", db->masterRegistrationCount);
957 return;
958 }
959
960 if (req.recoveryState == RecoveryState::FULLY_RECOVERED) {
961 self->db.unfinishedRecoveries = 0;
962 self->db.logGenerations = 0;
963 ASSERT(!req.logSystemConfig.oldTLogs.size());
964 } else {
965 self->db.logGenerations = std::max<int>(self->db.logGenerations, req.logSystemConfig.oldTLogs.size());
966 }
967
968 db->masterRegistrationCount = req.registrationCount;
969 db->recoveryStalled = req.recoveryStalled;
970 if (req.configuration.present()) {
971 db->config = req.configuration.get();
972
973 if (req.recoveryState >= RecoveryState::ACCEPTING_COMMITS) {
974 self->gotFullyRecoveredConfig = true;
975 db->fullyRecoveredConfig = req.configuration.get();
976 for (auto& it : self->id_worker) {
977 bool isExcludedFromConfig =
978 db->fullyRecoveredConfig.isExcludedServer(it.second.details.interf.addresses());
979 if (it.second.priorityInfo.isExcluded != isExcludedFromConfig) {
980 it.second.priorityInfo.isExcluded = isExcludedFromConfig;
981 if (!it.second.reply.isSet()) {
982 it.second.reply.send(
983 RegisterWorkerReply(it.second.details.processClass, it.second.priorityInfo));
984 }
985 }
986 }
987 }
988 }
989

Callers 1

whenFunction · 0.85

Calls 15

TraceEventClass · 0.85
RegisterWorkerReplyClass · 0.85
deterministicRandomFunction · 0.85
tenantModeForClusterTypeFunction · 0.85
checkOutstandingRequestsFunction · 0.85
detailMethod · 0.80
isExcludedServerMethod · 0.80
randomUniqueIDMethod · 0.80
describeFunction · 0.70
getMethod · 0.65
setMethod · 0.65
VoidClass · 0.50

Tested by

no test coverage detected