Skip to content

Commit

Permalink
Merge pull request #11396 from apple/r73-fixlogs
Browse files Browse the repository at this point in the history
Cherry-pick PR 11385 Only emit version vector counters when enabled.
  • Loading branch information
jzhou77 committed May 18, 2024
2 parents aceeb6c + 325967a commit 886f6c8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 29 deletions.
22 changes: 13 additions & 9 deletions fdbserver/GrvProxyServer.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ struct GrvProxyData {
Optional<LatencyBandConfig> latencyBandConfig;
double lastStartCommit;
double lastCommitLatency;
LatencySample versionVectorSizeOnGRVReply;
std::unique_ptr<LatencySample> versionVectorSizeOnGRVReply;
int updateCommitRequests;
NotifiedDouble lastCommitTime;

Expand Down Expand Up @@ -213,13 +213,17 @@ struct GrvProxyData {
Reference<AsyncVar<ServerDBInfo> const> db)
: dbgid(dbgid), stats(dbgid), master(master), getConsistentReadVersion(getConsistentReadVersion),
cx(openDBOnServer(db, TaskPriority::DefaultEndpoint, LockAware::True)), db(db), lastStartCommit(0),
lastCommitLatency(SERVER_KNOBS->REQUIRED_MIN_RECOVERY_DURATION),
versionVectorSizeOnGRVReply("VersionVectorSizeOnGRVReply",
dbgid,
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY),
updateCommitRequests(0), lastCommitTime(0), version(0), minKnownCommittedVersion(invalidVersion),
tagThrottler(CLIENT_KNOBS->PROXY_MAX_TAG_THROTTLE_DURATION) {}
lastCommitLatency(SERVER_KNOBS->REQUIRED_MIN_RECOVERY_DURATION), updateCommitRequests(0), lastCommitTime(0),
version(0), minKnownCommittedVersion(invalidVersion),
tagThrottler(CLIENT_KNOBS->PROXY_MAX_TAG_THROTTLE_DURATION) {
if (SERVER_KNOBS->ENABLE_VERSION_VECTOR) {
versionVectorSizeOnGRVReply =
std::make_unique<LatencySample>("VersionVectorSizeOnGRVReply",
dbgid,
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY);
}
}
};

ACTOR Future<Void> healthMetricsRequestServer(GrvProxyInterface grvProxy,
Expand Down Expand Up @@ -728,7 +732,7 @@ ACTOR Future<Void> sendGrvReplies(Future<GetReadVersionReply> replyFuture,
reply.tagThrottleInfo.clear();
if (SERVER_KNOBS->ENABLE_VERSION_VECTOR) {
grvProxyData->ssVersionVectorCache.getDelta(request.maxVersion, reply.ssVersionVectorDelta);
grvProxyData->versionVectorSizeOnGRVReply.addMeasurement(reply.ssVersionVectorDelta.size());
grvProxyData->versionVectorSizeOnGRVReply->addMeasurement(reply.ssVersionVectorDelta.size());
}
reply.proxyId = grvProxyData->dbgid;
reply.proxyTagThrottledDuration = request.proxyTagThrottledDuration;
Expand Down
42 changes: 22 additions & 20 deletions fdbserver/masterserver.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ struct MasterData : NonCopyable, ReferenceCounted<MasterData> {
Counter reportLiveCommittedVersionRequests;
// This counter gives an estimate of the number of non-empty peeks that storage servers
// should do from tlogs (in the worst case, ignoring blocking peek timeouts).
LatencySample versionVectorTagUpdates;
std::unique_ptr<LatencySample> versionVectorTagUpdates;
Counter waitForPrevCommitRequests;
Counter nonWaitForPrevCommitRequests;
LatencySample versionVectorSizeOnCVReply;
LatencySample waitForPrevLatencies;
std::unique_ptr<LatencySample> versionVectorSizeOnCVReply;
std::unique_ptr<LatencySample> waitForPrevLatencies;

PromiseStream<Future<Void>> addActor;

Expand All @@ -106,21 +106,23 @@ struct MasterData : NonCopyable, ReferenceCounted<MasterData> {
getCommitVersionRequests("GetCommitVersionRequests", cc),
getLiveCommittedVersionRequests("GetLiveCommittedVersionRequests", cc),
reportLiveCommittedVersionRequests("ReportLiveCommittedVersionRequests", cc),
versionVectorTagUpdates("VersionVectorTagUpdates",
dbgid,
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY),
waitForPrevCommitRequests("WaitForPrevCommitRequests", cc),
nonWaitForPrevCommitRequests("NonWaitForPrevCommitRequests", cc),
versionVectorSizeOnCVReply("VersionVectorSizeOnCVReply",
dbgid,
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY),
waitForPrevLatencies("WaitForPrevLatencies",
dbgid,
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY),
addActor(addActor) {
nonWaitForPrevCommitRequests("NonWaitForPrevCommitRequests", cc), addActor(addActor) {

if (SERVER_KNOBS->ENABLE_VERSION_VECTOR) {
versionVectorTagUpdates = std::make_unique<LatencySample>("VersionVectorTagUpdates",
dbgid,
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY);
versionVectorSizeOnCVReply = std::make_unique<LatencySample>("VersionVectorSizeOnCVReply",
dbgid,
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY);
waitForPrevLatencies = std::make_unique<LatencySample>("WaitForPrevLatencies",
dbgid,
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY);
}
logger = cc.traceCounters("MasterMetrics", dbgid, SERVER_KNOBS->WORKER_LOGGING_INTERVAL, "MasterMetrics");
if (forceRecovery && !myInterface.locality.dcId().present()) {
TraceEvent(SevError, "ForcedRecoveryRequiresDcID").log();
Expand Down Expand Up @@ -261,7 +263,7 @@ void updateLiveCommittedVersion(Reference<MasterData> self, ReportRawCommittedVe
int8_t primaryLocality =
SERVER_KNOBS->ENABLE_VERSION_VECTOR_HA_OPTIMIZATION ? self->locality : tagLocalityInvalid;
self->ssVersionVector.setVersion(req.writtenTags.get(), req.version, primaryLocality);
self->versionVectorTagUpdates.addMeasurement(req.writtenTags.get().size());
self->versionVectorTagUpdates->addMeasurement(req.writtenTags.get().size());
}
auto curTime = now();
// add debug here to change liveCommittedVersion to time bound of now()
Expand All @@ -280,7 +282,7 @@ ACTOR Future<Void> waitForPrev(Reference<MasterData> self, ReportRawCommittedVer
state double startTime = now();
wait(self->liveCommittedVersion.whenAtLeast(req.prevVersion.get()));
double latency = now() - startTime;
self->waitForPrevLatencies.addMeasurement(latency);
self->waitForPrevLatencies->addMeasurement(latency);
++self->waitForPrevCommitRequests;
updateLiveCommittedVersion(self, req);
req.reply.send(Void());
Expand All @@ -307,7 +309,7 @@ ACTOR Future<Void> serveLiveCommittedVersion(Reference<MasterData> self) {
reply.minKnownCommittedVersion = self->minKnownCommittedVersion;
if (SERVER_KNOBS->ENABLE_VERSION_VECTOR) {
self->ssVersionVector.getDelta(req.maxVersion, reply.ssVersionVectorDelta);
self->versionVectorSizeOnCVReply.addMeasurement(reply.ssVersionVectorDelta.size());
self->versionVectorSizeOnCVReply->addMeasurement(reply.ssVersionVectorDelta.size());
}
req.reply.send(reply);
}
Expand Down

0 comments on commit 886f6c8

Please sign in to comment.