diff --git a/fdbserver/masterserver.actor.cpp b/fdbserver/masterserver.actor.cpp index 5fbf5bc2de..179c2e5c75 100644 --- a/fdbserver/masterserver.actor.cpp +++ b/fdbserver/masterserver.actor.cpp @@ -245,6 +245,15 @@ struct MasterData : NonCopyable, ReferenceCounted { std::vector backupWorkers; // Recruited backup workers from cluster controller. + CounterCollection cc; + Counter changeCoordinatorsRequests; + Counter getCommitVersionRequests; + Counter backupWorkerDoneRequests; + Counter getLiveCommittedVersionRequests; + Counter reportLiveCommittedVersionRequests; + + Future logger; + MasterData(Reference> const& dbInfo, MasterInterface const& myInterface, ServerCoordinators const& coordinators, @@ -258,7 +267,13 @@ struct MasterData : NonCopyable, ReferenceCounted { lastEpochEnd(invalidVersion), liveCommittedVersion(invalidVersion), databaseLocked(false), minKnownCommittedVersion(invalidVersion), recoveryTransactionVersion(invalidVersion), lastCommitTime(0), registrationCount(0), version(invalidVersion), lastVersionTime(0), txnStateStore(0), memoryLimit(2e9), - addActor(addActor), hasConfiguration(false), recruitmentStalled(makeReference>(false)) { + addActor(addActor), hasConfiguration(false), recruitmentStalled(makeReference>(false)), + cc("Master", dbgid.toString()), changeCoordinatorsRequests("ChangeCoordinatorsRequests", cc), + getCommitVersionRequests("GetCommitVersionRequests", cc), + backupWorkerDoneRequests("BackupWorkerDoneRequests", cc), + getLiveCommittedVersionRequests("GetLiveCommittedVersionRequests", cc), + reportLiveCommittedVersionRequests("ReportLiveCommittedVersionRequests", cc) { + logger = traceCounters("MasterMetrics", dbgid, SERVER_KNOBS->WORKER_LOGGING_INTERVAL, &cc, "MasterMetrics"); if (forceRecovery && !myInterface.locality.dcId().present()) { TraceEvent(SevError, "ForcedRecoveryRequiresDcID"); forceRecovery = false; @@ -1095,6 +1110,8 @@ ACTOR Future getVersion(Reference self, GetCommitVersionReques state std::map::iterator proxyItr = self->lastCommitProxyVersionReplies.find(req.requestingProxy); // lastCommitProxyVersionReplies never changes + ++self->getCommitVersionRequests; + if (proxyItr == self->lastCommitProxyVersionReplies.end()) { // Request from invalid proxy (e.g. from duplicate recruitment request) req.reply.send(Never()); @@ -1191,6 +1208,7 @@ ACTOR Future serveLiveCommittedVersion(Reference self) { if (self->liveCommittedVersion == invalidVersion) { self->liveCommittedVersion = self->recoveryTransactionVersion; } + ++self->getLiveCommittedVersionRequests; GetRawCommittedVersionReply reply; reply.version = self->liveCommittedVersion; reply.locked = self->databaseLocked; @@ -1206,6 +1224,7 @@ ACTOR Future serveLiveCommittedVersion(Reference self) { self->databaseLocked = req.locked; self->proxyMetadataVersion = req.metadataVersion; } + ++self->reportLiveCommittedVersionRequests; req.reply.send(Void()); } } @@ -1374,6 +1393,7 @@ static std::set const& normalMasterErrors() { ACTOR Future changeCoordinators(Reference self) { loop { ChangeCoordinatorsRequest req = waitNext(self->myInterface.changeCoordinators.getFuture()); + ++self->changeCoordinatorsRequests; state ChangeCoordinatorsRequest changeCoordinatorsRequest = req; while (!self->cstate.previousWrite.isReady()) { @@ -1981,6 +2001,7 @@ ACTOR Future masterServer(MasterInterface mi, if (self->logSystem.isValid() && self->logSystem->removeBackupWorker(req)) { self->registrationTrigger.trigger(); } + ++self->backupWorkerDoneRequests; req.reply.send(Void()); } when(wait(collection)) {