Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherrypick "add MasterMetrics periodic logging" to 6.3. #4829

Merged
merged 1 commit into from Jun 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 22 additions & 6 deletions fdbserver/masterserver.actor.cpp
Expand Up @@ -235,6 +235,13 @@ struct MasterData : NonCopyable, ReferenceCounted<MasterData> {

std::vector<WorkerInterface> backupWorkers; // Recruited backup workers from cluster controller.

CounterCollection cc;
Counter changeCoordinatorsRequests;
Counter getCommitVersionRequests;
Counter backupWorkerDoneRequests;

Future<Void> logger;

MasterData(Reference<AsyncVar<ServerDBInfo>> const& dbInfo,
MasterInterface const& myInterface,
ServerCoordinators const& coordinators,
Expand All @@ -248,7 +255,11 @@ struct MasterData : NonCopyable, ReferenceCounted<MasterData> {
lastEpochEnd(invalidVersion), recoveryTransactionVersion(invalidVersion), lastCommitTime(0),
registrationCount(0), version(invalidVersion), lastVersionTime(0), txnStateStore(0), memoryLimit(2e9),
addActor(addActor), hasConfiguration(false),
recruitmentStalled(Reference<AsyncVar<bool>>(new AsyncVar<bool>())) {
recruitmentStalled(Reference<AsyncVar<bool>>(new AsyncVar<bool>())), cc("Master", dbgid.toString()),
changeCoordinatorsRequests("ChangeCoordinatorsRequests", cc),
getCommitVersionRequests("GetCommitVersionRequests", cc),
backupWorkerDoneRequests("BackupWorkerDoneRequests", cc) {
logger = traceCounters("MasterMetrics", dbgid, SERVER_KNOBS->WORKER_LOGGING_INTERVAL, &cc, "MasterMetrics");
if (forceRecovery && !myInterface.locality.dcId().present()) {
TraceEvent(SevError, "ForcedRecoveryRequiresDcID");
forceRecovery = false;
Expand Down Expand Up @@ -582,7 +593,7 @@ ACTOR Future<Standalone<CommitTransactionRef>> provisionalMaster(Reference<Maste
req.reply.send(Never()); // don't reply (clients always get commit_unknown_result)
auto t = &req.transaction;
if (t->read_snapshot == parent->lastEpochEnd && //< So no transactions can fall between the read snapshot
//and the recovery transaction this (might) be merged with
// and the recovery transaction this (might) be merged with
// vvv and also the changes we will make in the recovery
// transaction (most notably to lastEpochEndKey) BEFORE we
// merge initialConfChanges won't conflict
Expand Down Expand Up @@ -818,8 +829,8 @@ ACTOR Future<Void> readTransactionSystemState(Reference<MasterData> self,

self->txnStateLogAdapter->setNextVersion(
oldLogSystem->getEnd()); //< FIXME: (1) the log adapter should do this automatically after recovery; (2) if we
//make KeyValueStoreMemory guarantee immediate reads, we should be able to get rid of
//the discardCommit() below and not need a writable log adapter
// make KeyValueStoreMemory guarantee immediate reads, we should be able to get rid of
// the discardCommit() below and not need a writable log adapter

TraceEvent("RTSSComplete", self->dbgid);

Expand Down Expand Up @@ -1037,6 +1048,8 @@ ACTOR Future<Void> getVersion(Reference<MasterData> self, GetCommitVersionReques
state std::map<UID, ProxyVersionReplies>::iterator proxyItr =
self->lastProxyVersionReplies.find(req.requestingProxy); // lastProxyVersionReplies never changes

++self->getCommitVersionRequests;

if (proxyItr == self->lastProxyVersionReplies.end()) {
// Request from invalid proxy (e.g. from duplicate recruitment request)
req.reply.send(Never());
Expand Down Expand Up @@ -1282,6 +1295,7 @@ static std::set<int> const& normalMasterErrors() {
ACTOR Future<Void> changeCoordinators(Reference<MasterData> self) {
loop {
ChangeCoordinatorsRequest req = waitNext(self->myInterface.changeCoordinators.getFuture());
++self->changeCoordinatorsRequests;
state ChangeCoordinatorsRequest changeCoordinatorsRequest = req;

while (!self->cstate.previousWrite.isReady()) {
Expand Down Expand Up @@ -1706,8 +1720,9 @@ ACTOR Future<Void> masterCore(Reference<MasterData> self) {
// tr.set(recoveryCommitRequest.arena, cacheKeysKey(0, normalKeys.begin), serverKeysTrue);
// tr.set(recoveryCommitRequest.arena, cacheKeysKey(0, normalKeys.end), serverKeysFalse);
// tr.set(recoveryCommitRequest.arena, cacheChangeKeyFor(0),
// BinaryWriter::toValue(deterministicRandom()->randomUniqueID(),Unversioned())); tr.set(recoveryCommitRequest.arena,
// cacheChangeKey, BinaryWriter::toValue(deterministicRandom()->randomUniqueID(),Unversioned()));
// BinaryWriter::toValue(deterministicRandom()->randomUniqueID(),Unversioned()));
// tr.set(recoveryCommitRequest.arena, cacheChangeKey,
// BinaryWriter::toValue(deterministicRandom()->randomUniqueID(),Unversioned()));

tr.clear(recoveryCommitRequest.arena, tLogDatacentersKeys);
for (auto& dc : self->primaryDcId) {
Expand Down Expand Up @@ -1868,6 +1883,7 @@ ACTOR Future<Void> masterServer(MasterInterface mi,
if (self->logSystem.isValid() && self->logSystem->removeBackupWorker(req)) {
self->registrationTrigger.trigger();
}
++self->backupWorkerDoneRequests;
req.reply.send(Void());
}
when(wait(collection)) {
Expand Down