From 3794dbb00006ae2530b2b3f93f896b8b9335a6e1 Mon Sep 17 00:00:00 2001 From: Jonathan Klabunde Tomer Date: Fri, 24 Jul 2026 10:52:52 -0700 Subject: [PATCH 1/9] always increment finishedQueries counter if incrementing allQueries --- fdbrpc/include/fdbrpc/Stats.h | 13 +++++++++++++ fdbserver/storageserver.actor.cpp | 18 ++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/fdbrpc/include/fdbrpc/Stats.h b/fdbrpc/include/fdbrpc/Stats.h index ef0e3b0dcc9..fb82ddb196b 100644 --- a/fdbrpc/include/fdbrpc/Stats.h +++ b/fdbrpc/include/fdbrpc/Stats.h @@ -158,6 +158,19 @@ struct Traceable : std::true_type { } }; +// Increments one counter at construction, and another at destruction; +// intended to be used to mark the beginning and end of some scope, without +// the possibility of forgetting to increment the exit counter on exceptions. +class CountedSection final : public NonCopyable { +public: + CountedSection() : end(nullptr) {} + CountedSection(Counter &start, Counter &end) : end(&end) { ++start; } + CountedSection &operator=(CountedSection &&other) { std::swap(end, other.end); return *this; } + ~CountedSection() { if (end) ++*end; } +private: + Counter *end; +}; + template struct SpecialCounter final : ICounter, FastAllocated>, NonCopyable { SpecialCounter(CounterCollection& collection, std::string const& name, F&& f) : name(name), f(f) { diff --git a/fdbserver/storageserver.actor.cpp b/fdbserver/storageserver.actor.cpp index dbb6770232c..5941f89956a 100644 --- a/fdbserver/storageserver.actor.cpp +++ b/fdbserver/storageserver.actor.cpp @@ -2416,12 +2416,12 @@ std::shared_ptr StorageServer::getMoveInShard(const UID& dataMoveId ACTOR Future getValueQ(StorageServer* data, GetValueRequest req) { state int64_t resultSize = 0; Span span("SS:getValue"_loc, req.spanContext); + state CountedSection cs(data->counters.allQueries, data->counters.finishedQueries); // Temporarily disabled -- this path is hit a lot // getCurrentLineage()->modify(&TransactionLineage::txID) = req.spanContext.first(); try { ++data->counters.getValueQueries; - ++data->counters.allQueries; if (req.key.startsWith(systemKeys.begin)) { ++data->counters.systemKeyQueries; } @@ -2540,8 +2540,6 @@ ACTOR Future getValueQ(StorageServer* data, GetValueRequest req) { // so it must be accounted for here. data->transactionTagCounter.addRequest(req.tags, req.key.size() + resultSize); - ++data->counters.finishedQueries; - double duration = g_network->timer() - req.requestTime(); data->counters.readLatencySample.addMeasurement(duration); data->counters.readValueLatencySample.addMeasurement(duration); @@ -4535,8 +4533,8 @@ ACTOR Future getKeyValuesQ(StorageServer* data, GetKeyValuesRequest req) getCurrentLineage()->modify(&TransactionLineage::txID) = req.spanContext.traceID; + state CountedSection cs(data->counters.allQueries, data->counters.finishedQueries); ++data->counters.getRangeQueries; - ++data->counters.allQueries; if (req.begin.getKey().startsWith(systemKeys.begin)) { ++data->counters.systemKeyQueries; ++data->counters.getRangeSystemKeyQueries; @@ -4711,7 +4709,6 @@ ACTOR Future getKeyValuesQ(StorageServer* data, GetKeyValuesRequest req) } data->transactionTagCounter.addRequest(req.tags, resultSize); - ++data->counters.finishedQueries; double duration = g_network->timer() - req.requestTime(); data->counters.readLatencySample.addMeasurement(duration); @@ -6224,8 +6221,8 @@ ACTOR Future getMappedKeyValuesQ(StorageServer* data, GetMappedKeyValuesRe getCurrentLineage()->modify(&TransactionLineage::txID) = req.spanContext.traceID; - ++data->counters.getMappedRangeQueries; - ++data->counters.allQueries; + state CountedSection csAll(data->counters.allQueries, data->counters.finishedQueries); + state CountedSection csRangeMapped(data->counters.getMappedRangeQueries, data->counters.finishedGetMappedRangeQueries); if (req.begin.getKey().startsWith(systemKeys.begin)) { ++data->counters.systemKeyQueries; } @@ -6404,8 +6401,6 @@ ACTOR Future getMappedKeyValuesQ(StorageServer* data, GetMappedKeyValuesRe } data->transactionTagCounter.addRequest(req.tags, resultSize); - ++data->counters.finishedQueries; - ++data->counters.finishedGetMappedRangeQueries; double duration = g_network->timer() - req.requestTime(); data->counters.readLatencySample.addMeasurement(duration); @@ -6433,8 +6428,8 @@ ACTOR Future getKeyValuesStreamQ(StorageServer* data, GetKeyValuesStreamRe state int64_t resultSize = 0; req.reply.setByteLimit(SERVER_KNOBS->RANGESTREAM_LIMIT_BYTES); + state CountedSection cs(data->counters.allQueries, data->counters.finishedQueries); ++data->counters.getRangeStreamQueries; - ++data->counters.allQueries; if (req.begin.getKey().startsWith(systemKeys.begin)) { ++data->counters.systemKeyQueries; } @@ -6632,7 +6627,6 @@ ACTOR Future getKeyValuesStreamQ(StorageServer* data, GetKeyValuesStreamRe } data->transactionTagCounter.addRequest(req.tags, resultSize); - ++data->counters.finishedQueries; return Void(); } @@ -6643,8 +6637,8 @@ ACTOR Future getKeyQ(StorageServer* data, GetKeyRequest req) { getCurrentLineage()->modify(&TransactionLineage::txID) = req.spanContext.traceID; + state CountedSection cs(data->counters.allQueries, data->counters.finishedQueries); ++data->counters.getKeyQueries; - ++data->counters.allQueries; data->maxQueryQueue = std::max( data->maxQueryQueue, data->counters.allQueries.getValue() - data->counters.finishedQueries.getValue()); From 3622c71b3bc70af9e8ff8a178d849a968e377c4d Mon Sep 17 00:00:00 2001 From: Jonathan Klabunde Tomer Date: Thu, 30 Jul 2026 13:18:52 -0700 Subject: [PATCH 2/9] move counters before actors in StorageServer class body to correct destructor-order issue --- fdbserver/storageserver.actor.cpp | 155 +++++++++++++++--------------- 1 file changed, 78 insertions(+), 77 deletions(-) diff --git a/fdbserver/storageserver.actor.cpp b/fdbserver/storageserver.actor.cpp index 5941f89956a..bec2cfdd562 100644 --- a/fdbserver/storageserver.actor.cpp +++ b/fdbserver/storageserver.actor.cpp @@ -1310,83 +1310,6 @@ struct StorageServer : public IStorageMetricsService { Key sk; Reference const> db; Database cx; - ActorCollection actors; - - CoalescedKeyRangeMap> byteSampleClears; - AsyncVar byteSampleClearsTooLarge; - Future byteSampleRecovery; - Future durableInProgress; - - AsyncMap watches; - AsyncMap tenantWatches; - int64_t watchBytes; - int64_t numWatches; - AsyncVar noRecentUpdates; - double lastUpdate; - - std::string folder; - std::string checkpointFolder; - std::string fetchedCheckpointFolder; - - // defined only during splitMutations()/addMutation() - UpdateEagerReadInfo* updateEagerReads; - - FlowLock durableVersionLock; - FlowLock fetchKeysParallelismLock; - // Extra lock that prevents too much post-initial-fetch work from building up, such as mutation applying and change - // feed tail fetching - FlowLock fetchKeysParallelismChangeFeedLock; - int64_t fetchKeysBytesBudget; - AsyncVar fetchKeysBudgetUsed; - int64_t fetchKeysTotalCommitBytes; - std::vector> readyFetchKeys; - - FlowLock serveFetchCheckpointParallelismLock; - - std::unordered_map> moveInShards; - - Reference ssLock; - std::vector readPriorityRanks; - - Future getReadLock(const Optional& options) { - int readType = (int)(options.present() ? options.get().type : ReadType::NORMAL); - readType = std::clamp(readType, 0, readPriorityRanks.size() - 1); - return ssLock->lock(readPriorityRanks[readType]); - } - - FlowLock serveAuditStorageParallelismLock; - - int64_t instanceID; - - Promise otherError; - Promise coreStarted; - bool shuttingDown; - - Promise registerInterfaceAcceptingRequests; - Future interfaceRegistered; - - bool behind; - bool versionBehind; - - bool debug_inApplyUpdate; - double debug_lastValidateTime; - - int64_t lastBytesInputEBrake; - Version lastDurableVersionEBrake; - - int maxQueryQueue; - int getAndResetMaxQueryQueueSize() { - int val = maxQueryQueue; - maxQueryQueue = 0; - return val; - } - - TransactionTagCounter transactionTagCounter; - BusiestWriteTagContext busiestWriteTagContext; - - Optional latencyBandConfig; - - Optional encryptionMode; struct Counters { CounterCollection cc; @@ -1616,6 +1539,84 @@ struct StorageServer : public IStorageMetricsService { } } counters; + ActorCollection actors; + + CoalescedKeyRangeMap> byteSampleClears; + AsyncVar byteSampleClearsTooLarge; + Future byteSampleRecovery; + Future durableInProgress; + + AsyncMap watches; + AsyncMap tenantWatches; + int64_t watchBytes; + int64_t numWatches; + AsyncVar noRecentUpdates; + double lastUpdate; + + std::string folder; + std::string checkpointFolder; + std::string fetchedCheckpointFolder; + + // defined only during splitMutations()/addMutation() + UpdateEagerReadInfo* updateEagerReads; + + FlowLock durableVersionLock; + FlowLock fetchKeysParallelismLock; + // Extra lock that prevents too much post-initial-fetch work from building up, such as mutation applying and change + // feed tail fetching + FlowLock fetchKeysParallelismChangeFeedLock; + int64_t fetchKeysBytesBudget; + AsyncVar fetchKeysBudgetUsed; + int64_t fetchKeysTotalCommitBytes; + std::vector> readyFetchKeys; + + FlowLock serveFetchCheckpointParallelismLock; + + std::unordered_map> moveInShards; + + Reference ssLock; + std::vector readPriorityRanks; + + Future getReadLock(const Optional& options) { + int readType = (int)(options.present() ? options.get().type : ReadType::NORMAL); + readType = std::clamp(readType, 0, readPriorityRanks.size() - 1); + return ssLock->lock(readPriorityRanks[readType]); + } + + FlowLock serveAuditStorageParallelismLock; + + int64_t instanceID; + + Promise otherError; + Promise coreStarted; + bool shuttingDown; + + Promise registerInterfaceAcceptingRequests; + Future interfaceRegistered; + + bool behind; + bool versionBehind; + + bool debug_inApplyUpdate; + double debug_lastValidateTime; + + int64_t lastBytesInputEBrake; + Version lastDurableVersionEBrake; + + int maxQueryQueue; + int getAndResetMaxQueryQueueSize() { + int val = maxQueryQueue; + maxQueryQueue = 0; + return val; + } + + TransactionTagCounter transactionTagCounter; + BusiestWriteTagContext busiestWriteTagContext; + + Optional latencyBandConfig; + + Optional encryptionMode; + // Bytes read from storage engine when a storage server starts. int64_t bytesRestored = 0; From 6be608214885a92f21337d7f8ce30337ea1b5e57 Mon Sep 17 00:00:00 2001 From: Jonathan Klabunde Tomer Date: Tue, 18 Aug 2026 11:23:54 -0700 Subject: [PATCH 3/9] add unit test for CountedSection --- fdbrpc/CountedSectionTest.actor.cpp | 66 +++++++++++++++++++++++++ fdbserver/workloads/UnitTests.actor.cpp | 2 + 2 files changed, 68 insertions(+) create mode 100644 fdbrpc/CountedSectionTest.actor.cpp diff --git a/fdbrpc/CountedSectionTest.actor.cpp b/fdbrpc/CountedSectionTest.actor.cpp new file mode 100644 index 00000000000..d0593a7cfed --- /dev/null +++ b/fdbrpc/CountedSectionTest.actor.cpp @@ -0,0 +1,66 @@ +/* + * StatsTest.actor.cpp + * + * This source file is part of the FoundationDB open source project + * + * Copyright 2013-2022 Apple Inc. and the FoundationDB project authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include "fdbrpc/Stats.h" +#include "flow/UnitTest.h" +#include "flow/actorcompiler.h" // This must be the last #include. + +void forceLinkCountedSectionTests() {} + +struct TestCounters { + CounterCollection cc; + Counter start; + Counter end; + + TestCounters() : cc("CountedSectionTest"), start("start", cc), end("end", cc) {} +}; + +ACTOR Future doNothing(TestCounters *tc, Future f) { + CountedSection cs(tc->start, tc->end); + wait(f); + return Void(); +} + +TEST_CASE("/fdbrpc/countedsection/uninterrupted") { + state TestCounters tc; + + Promise signal; + auto nothing = doNothing(&tc, signal.getFuture()); + signal.send(Void()); + wait(nothing); + + ASSERT(tc.start.getValue() == 1); + ASSERT(tc.end.getValue() == 1); + return Void(); +} + +TEST_CASE("/fdbrpc/countedesction/interrupted") { + state TestCounters tc; + + { + Promise signal; + auto nothing = doNothing(&tc, signal.getFuture()); + } + + ASSERT(tc.start.getValue() == 1); + ASSERT(tc.end.getValue() == 1); + return Void(); +} diff --git a/fdbserver/workloads/UnitTests.actor.cpp b/fdbserver/workloads/UnitTests.actor.cpp index 3226660fb52..84d1b743eb2 100644 --- a/fdbserver/workloads/UnitTests.actor.cpp +++ b/fdbserver/workloads/UnitTests.actor.cpp @@ -57,6 +57,7 @@ void forceLinkActorFuzzUnitTests(); void forceLinkGrpcTests(); void forceLinkGrpcTests2(); void forceLinkSimpleCounterTests(); +void forceLinkCountedSectionTests(); struct UnitTestWorkload : TestWorkload { static constexpr auto NAME = "UnitTests"; @@ -124,6 +125,7 @@ struct UnitTestWorkload : TestWorkload { forceLinkWipedStringTests(); forceLinkRandomKeyValueUtilsTests(); forceLinkSimpleCounterTests(); + forceLinkCountedSectionTests(); #ifdef FLOW_GRPC_ENABLED forceLinkGrpcTests(); From 08c98d141f5eabc33f87eb0cb73400044abcd26c Mon Sep 17 00:00:00 2001 From: Jonathan Klabunde Tomer Date: Tue, 18 Aug 2026 11:26:17 -0700 Subject: [PATCH 4/9] remove spurious remaining finishedQueries bump --- fdbserver/storageserver.actor.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/fdbserver/storageserver.actor.cpp b/fdbserver/storageserver.actor.cpp index bec2cfdd562..29169535e46 100644 --- a/fdbserver/storageserver.actor.cpp +++ b/fdbserver/storageserver.actor.cpp @@ -6715,8 +6715,6 @@ ACTOR Future getKeyQ(StorageServer* data, GetKeyRequest req) { // used if read-your-writes is disabled data->transactionTagCounter.addRequest(req.tags, resultSize); - ++data->counters.finishedQueries; - double duration = g_network->timer() - req.requestTime(); data->counters.readLatencySample.addMeasurement(duration); data->counters.readKeyLatencySample.addMeasurement(duration); From 20a22494ea881f93d0cb36fff73d872ad78674ef Mon Sep 17 00:00:00 2001 From: Jonathan Klabunde Tomer Date: Tue, 18 Aug 2026 13:44:54 -0700 Subject: [PATCH 5/9] make CountedSection in test state --- fdbrpc/CountedSectionTest.actor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdbrpc/CountedSectionTest.actor.cpp b/fdbrpc/CountedSectionTest.actor.cpp index d0593a7cfed..e5908d0da3d 100644 --- a/fdbrpc/CountedSectionTest.actor.cpp +++ b/fdbrpc/CountedSectionTest.actor.cpp @@ -34,7 +34,7 @@ struct TestCounters { }; ACTOR Future doNothing(TestCounters *tc, Future f) { - CountedSection cs(tc->start, tc->end); + state CountedSection cs(tc->start, tc->end); wait(f); return Void(); } From c73b26207e6f4a91daeba4992dfb5f76683771be Mon Sep 17 00:00:00 2001 From: Jonathan Klabunde Tomer Date: Wed, 19 Aug 2026 13:46:43 -0700 Subject: [PATCH 6/9] fix indentation --- fdbserver/workloads/UnitTests.actor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdbserver/workloads/UnitTests.actor.cpp b/fdbserver/workloads/UnitTests.actor.cpp index 84d1b743eb2..f324856effa 100644 --- a/fdbserver/workloads/UnitTests.actor.cpp +++ b/fdbserver/workloads/UnitTests.actor.cpp @@ -125,7 +125,7 @@ struct UnitTestWorkload : TestWorkload { forceLinkWipedStringTests(); forceLinkRandomKeyValueUtilsTests(); forceLinkSimpleCounterTests(); - forceLinkCountedSectionTests(); + forceLinkCountedSectionTests(); #ifdef FLOW_GRPC_ENABLED forceLinkGrpcTests(); From 329c00f7355a3fa9e096da970d290464b6338ef6 Mon Sep 17 00:00:00 2001 From: Jonathan Klabunde Tomer Date: Wed, 19 Aug 2026 13:58:31 -0700 Subject: [PATCH 7/9] clang-format --- fdbrpc/CountedSectionTest.actor.cpp | 6 +++--- fdbrpc/include/fdbrpc/Stats.h | 15 +++++++++++---- fdbserver/storageserver.actor.cpp | 3 ++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/fdbrpc/CountedSectionTest.actor.cpp b/fdbrpc/CountedSectionTest.actor.cpp index e5908d0da3d..7b6d0b3333d 100644 --- a/fdbrpc/CountedSectionTest.actor.cpp +++ b/fdbrpc/CountedSectionTest.actor.cpp @@ -33,7 +33,7 @@ struct TestCounters { TestCounters() : cc("CountedSectionTest"), start("start", cc), end("end", cc) {} }; -ACTOR Future doNothing(TestCounters *tc, Future f) { +ACTOR Future doNothing(TestCounters* tc, Future f) { state CountedSection cs(tc->start, tc->end); wait(f); return Void(); @@ -49,7 +49,7 @@ TEST_CASE("/fdbrpc/countedsection/uninterrupted") { ASSERT(tc.start.getValue() == 1); ASSERT(tc.end.getValue() == 1); - return Void(); + return Void(); } TEST_CASE("/fdbrpc/countedesction/interrupted") { @@ -62,5 +62,5 @@ TEST_CASE("/fdbrpc/countedesction/interrupted") { ASSERT(tc.start.getValue() == 1); ASSERT(tc.end.getValue() == 1); - return Void(); + return Void(); } diff --git a/fdbrpc/include/fdbrpc/Stats.h b/fdbrpc/include/fdbrpc/Stats.h index fb82ddb196b..8b1f76d66fe 100644 --- a/fdbrpc/include/fdbrpc/Stats.h +++ b/fdbrpc/include/fdbrpc/Stats.h @@ -164,11 +164,18 @@ struct Traceable : std::true_type { class CountedSection final : public NonCopyable { public: CountedSection() : end(nullptr) {} - CountedSection(Counter &start, Counter &end) : end(&end) { ++start; } - CountedSection &operator=(CountedSection &&other) { std::swap(end, other.end); return *this; } - ~CountedSection() { if (end) ++*end; } + CountedSection(Counter& start, Counter& end) : end(&end) { ++start; } + CountedSection& operator=(CountedSection&& other) { + std::swap(end, other.end); + return *this; + } + ~CountedSection() { + if (end) + ++*end; + } + private: - Counter *end; + Counter* end; }; template diff --git a/fdbserver/storageserver.actor.cpp b/fdbserver/storageserver.actor.cpp index 29169535e46..a7b64d3e512 100644 --- a/fdbserver/storageserver.actor.cpp +++ b/fdbserver/storageserver.actor.cpp @@ -6223,7 +6223,8 @@ ACTOR Future getMappedKeyValuesQ(StorageServer* data, GetMappedKeyValuesRe getCurrentLineage()->modify(&TransactionLineage::txID) = req.spanContext.traceID; state CountedSection csAll(data->counters.allQueries, data->counters.finishedQueries); - state CountedSection csRangeMapped(data->counters.getMappedRangeQueries, data->counters.finishedGetMappedRangeQueries); + state CountedSection csRangeMapped(data->counters.getMappedRangeQueries, + data->counters.finishedGetMappedRangeQueries); if (req.begin.getKey().startsWith(systemKeys.begin)) { ++data->counters.systemKeyQueries; } From 2084020be321281d1a1d4a8ebbdeecf1cfd87efc Mon Sep 17 00:00:00 2001 From: Jonathan Klabunde Tomer Date: Fri, 21 Aug 2026 13:15:46 -0700 Subject: [PATCH 8/9] move counters even earlier and add explanatory comment --- fdbserver/storageserver.actor.cpp | 457 +++++++++++++++--------------- 1 file changed, 229 insertions(+), 228 deletions(-) diff --git a/fdbserver/storageserver.actor.cpp b/fdbserver/storageserver.actor.cpp index a7b64d3e512..0fbe724d7ae 100644 --- a/fdbserver/storageserver.actor.cpp +++ b/fdbserver/storageserver.actor.cpp @@ -951,6 +951,235 @@ struct TenantSSInfo { struct StorageServer : public IStorageMetricsService { typedef VersionedMap VersionedData; + // counters must be declared before any member that can own an actor, since actor cancellation may increment counters + struct Counters { + CounterCollection cc; + Counter allQueries, systemKeyQueries, getKeyQueries, getValueQueries, getRangeQueries, getRangeSystemKeyQueries, + getRangeStreamQueries, finishedQueries, lowPriorityQueries, rowsQueried, bytesQueried, watchQueries, + emptyQueries, feedRowsQueried, feedBytesQueried, feedStreamQueries, rejectedFeedStreamQueries, + feedVersionQueries; + + // counters related to getMappedRange queries + Counter getMappedRangeBytesQueried, finishedGetMappedRangeSecondaryQueries, getMappedRangeQueries, + finishedGetMappedRangeQueries; + + // Bytes of the mutations that have been added to the memory of the storage server. When the data is durable + // and cleared from the memory, we do not subtract it but add it to bytesDurable. + Counter bytesInput; + // Bytes pulled from TLogs, it counts the size of the key value pairs, e.g., key-value pair ("a", "b") is + // counted as 2 Bytes. + Counter logicalBytesInput; + // Bytes pulled from TLogs for moving-in shards, it counts the mutations sent to the moving-in shard during + // Fetching and Waiting phases. + Counter logicalBytesMoveInOverhead; + // Bytes committed to the underlying storage engine by SS, it counts the size of key value pairs. + Counter kvCommitLogicalBytes; + // Count of all clearRange operations to the storage engine. + Counter kvClearRanges; + // Count of all clearRange operations on a singlekeyRange(key delete) to the storage engine. + Counter kvClearSingleKey; + // ClearRange operations issued by FDB, instead of from users, e.g., ClearRange operations to remove a shard + // from a storage server, as in removeDataRange(). + Counter kvSystemClearRanges; + // Bytes of the mutations that have been removed from memory because they durable. The counting is same as + // bytesInput, instead of the actual bytes taken in the storages, so that (bytesInput - bytesDurable) can + // reflect the current memory footprint of MVCC. + Counter bytesDurable; + // Bytes fetched by fetchKeys() for data movements. The size is counted as a collection of KeyValueRef. + Counter bytesFetched; + // Like bytesInput but without MVCC accounting. The size is counted as how much it takes when serialized. It + // is basically the size of both parameters of the mutation and a 12 bytes overhead that keeps mutation type + // and the lengths of both parameters. + Counter mutationBytes; + // Count of all fetchKey clearRange operations to the storage engine. + Counter kvClearRangesInFetchKeys; + + // Bytes fetched by fetchChangeFeed for data movements. + Counter feedBytesFetched; + + Counter sampledBytesCleared; + // The number of key-value pairs fetched by fetchKeys() + Counter kvFetched; + Counter mutations, setMutations, clearRangeMutations, atomicMutations, changeFeedMutations, + changeFeedMutationsDurable; + Counter updateBatches, updateVersions; + Counter loops; + Counter fetchWaitingMS, fetchWaitingCount, fetchExecutingMS, fetchExecutingCount; + Counter readsRejected; + Counter wrongShardServer; + Counter fetchedVersions; + Counter fetchesFromLogs; + // The following counters measure how many of lookups in the getMappedRangeQueries are effective. "Miss" + // means fallback if fallback is enabled, otherwise means failure (so that another layer could implement + // fallback). + Counter quickGetValueHit, quickGetValueMiss, quickGetKeyValuesHit, quickGetKeyValuesMiss; + + // The number of logical bytes returned from storage engine, in response to readRange operations. + Counter kvScanBytes; + // The number of logical bytes returned from storage engine, in response to readValue operations. + Counter kvGetBytes; + // The number of keys read from storage engine by eagerReads. + Counter eagerReadsKeys; + // The count of readValue operation to the storage engine. + Counter kvGets; + // The count of readValue operation to the storage engine. + Counter kvScans; + // The count of commit operation to the storage engine. + Counter kvCommits; + // The count of change feed reads that hit disk + Counter changeFeedDiskReads; + // The count of ChangeServerKeys actions. + Counter changeServerKeysAssigned; + Counter changeServerKeysUnassigned; + + // The count of 'set' inserted to pTree. The actual ptree.insert() number could be higher, because of the range + // clear split, see metric pTreeClearSplits. + Counter pTreeSets; + // The count of clear range inserted to pTree + Counter pTreeClears; + // If set is within a range of clear, the clear is split. It's tracking the number of splits, the split could be + // expensive. + Counter pTreeClearSplits; + + LatencySample readLatencySample; + LatencySample readKeyLatencySample; + LatencySample readValueLatencySample; + LatencySample readRangeLatencySample; + LatencySample readVersionWaitSample; + LatencySample readQueueWaitSample; + LatencySample kvReadRangeLatencySample; + LatencySample updateLatencySample; + + LatencyBands readLatencyBands; + LatencySample mappedRangeSample; // Samples getMappedRange latency + LatencySample mappedRangeRemoteSample; // Samples getMappedRange remote subquery latency + LatencySample mappedRangeLocalSample; // Samples getMappedRange local subquery latency + + Counters(StorageServer* self) + : cc("StorageServer", self->thisServerID.toString()), allQueries("QueryQueue", cc), + systemKeyQueries("SystemKeyQueries", cc), getKeyQueries("GetKeyQueries", cc), + getValueQueries("GetValueQueries", cc), getRangeQueries("GetRangeQueries", cc), + getRangeSystemKeyQueries("GetRangeSystemKeyQueries", cc), + getMappedRangeQueries("GetMappedRangeQueries", cc), getRangeStreamQueries("GetRangeStreamQueries", cc), + finishedQueries("FinishedQueries", cc), lowPriorityQueries("LowPriorityQueries", cc), + rowsQueried("RowsQueried", cc), bytesQueried("BytesQueried", cc), watchQueries("WatchQueries", cc), + emptyQueries("EmptyQueries", cc), feedRowsQueried("FeedRowsQueried", cc), + feedBytesQueried("FeedBytesQueried", cc), feedStreamQueries("FeedStreamQueries", cc), + rejectedFeedStreamQueries("RejectedFeedStreamQueries", cc), feedVersionQueries("FeedVersionQueries", cc), + bytesInput("BytesInput", cc), logicalBytesInput("LogicalBytesInput", cc), + logicalBytesMoveInOverhead("LogicalBytesMoveInOverhead", cc), + kvCommitLogicalBytes("KVCommitLogicalBytes", cc), kvClearRanges("KVClearRanges", cc), + kvClearSingleKey("KVClearSingleKey", cc), kvSystemClearRanges("KVSystemClearRanges", cc), + bytesDurable("BytesDurable", cc), bytesFetched("BytesFetched", cc), mutationBytes("MutationBytes", cc), + feedBytesFetched("FeedBytesFetched", cc), sampledBytesCleared("SampledBytesCleared", cc), + kvFetched("KVFetched", cc), mutations("Mutations", cc), setMutations("SetMutations", cc), + clearRangeMutations("ClearRangeMutations", cc), atomicMutations("AtomicMutations", cc), + changeFeedMutations("ChangeFeedMutations", cc), + changeFeedMutationsDurable("ChangeFeedMutationsDurable", cc), updateBatches("UpdateBatches", cc), + updateVersions("UpdateVersions", cc), loops("Loops", cc), fetchWaitingMS("FetchWaitingMS", cc), + fetchWaitingCount("FetchWaitingCount", cc), fetchExecutingMS("FetchExecutingMS", cc), + fetchExecutingCount("FetchExecutingCount", cc), readsRejected("ReadsRejected", cc), + wrongShardServer("WrongShardServer", cc), fetchedVersions("FetchedVersions", cc), + fetchesFromLogs("FetchesFromLogs", cc), quickGetValueHit("QuickGetValueHit", cc), + quickGetValueMiss("QuickGetValueMiss", cc), quickGetKeyValuesHit("QuickGetKeyValuesHit", cc), + quickGetKeyValuesMiss("QuickGetKeyValuesMiss", cc), kvScanBytes("KVScanBytes", cc), + kvGetBytes("KVGetBytes", cc), eagerReadsKeys("EagerReadsKeys", cc), kvGets("KVGets", cc), + kvScans("KVScans", cc), kvCommits("KVCommits", cc), changeFeedDiskReads("ChangeFeedDiskReads", cc), + getMappedRangeBytesQueried("GetMappedRangeBytesQueried", cc), + finishedGetMappedRangeQueries("FinishedGetMappedRangeQueries", cc), + finishedGetMappedRangeSecondaryQueries("FinishedGetMappedRangeSecondaryQueries", cc), + pTreeSets("PTreeSets", cc), pTreeClears("PTreeClears", cc), pTreeClearSplits("PTreeClearSplits", cc), + changeServerKeysAssigned("ChangeServerKeysAssigned", cc), + changeServerKeysUnassigned("ChangeServerKeysUnassigned", cc), + kvClearRangesInFetchKeys("KvClearRangesInFetchKeys", cc), + readLatencySample("ReadLatencyMetrics", + self->thisServerID, + SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, + SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), + readKeyLatencySample("GetKeyMetrics", + self->thisServerID, + SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, + SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), + readValueLatencySample("GetValueMetrics", + self->thisServerID, + SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, + SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), + readRangeLatencySample("GetRangeMetrics", + self->thisServerID, + SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, + SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), + readVersionWaitSample("ReadVersionWaitMetrics", + self->thisServerID, + SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, + SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), + readQueueWaitSample("ReadQueueWaitMetrics", + self->thisServerID, + SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, + SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), + readLatencyBands("ReadLatencyBands", self->thisServerID, SERVER_KNOBS->STORAGE_LOGGING_DELAY), + mappedRangeSample("GetMappedRangeMetrics", + self->thisServerID, + SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, + SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), + mappedRangeRemoteSample("GetMappedRangeRemoteMetrics", + self->thisServerID, + SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, + SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), + mappedRangeLocalSample("GetMappedRangeLocalMetrics", + self->thisServerID, + SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, + SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), + kvReadRangeLatencySample("KVGetRangeMetrics", + self->thisServerID, + SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, + SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), + updateLatencySample("UpdateLatencyMetrics", + self->thisServerID, + SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, + SERVER_KNOBS->LATENCY_SKETCH_ACCURACY) { + specialCounter(cc, "LastTLogVersion", [self]() { return self->lastTLogVersion; }); + specialCounter(cc, "Version", [self]() { return self->version.get(); }); + specialCounter(cc, "StorageVersion", [self]() { return self->storageVersion(); }); + specialCounter(cc, "DurableVersion", [self]() { return self->durableVersion.get(); }); + specialCounter(cc, "DesiredOldestVersion", [self]() { return self->desiredOldestVersion.get(); }); + specialCounter(cc, "VersionLag", [self]() { return self->versionLag; }); + specialCounter(cc, "LocalRate", [self] { return int64_t(self->currentRate() * 100); }); + + specialCounter(cc, "BytesReadSampleCount", [self]() { return self->metrics.bytesReadSample.queue.size(); }); + specialCounter( + cc, "FetchKeysFetchActive", [self]() { return self->fetchKeysParallelismLock.activePermits(); }); + specialCounter(cc, "FetchKeysWaiting", [self]() { return self->fetchKeysParallelismLock.waiters(); }); + specialCounter(cc, "FetchKeysChangeFeedFetchActive", [self]() { + return self->fetchKeysParallelismChangeFeedLock.activePermits(); + }); + specialCounter(cc, "FetchKeysFullFetchWaiting", [self]() { + return self->fetchKeysParallelismChangeFeedLock.waiters(); + }); + specialCounter(cc, "ServeFetchCheckpointActive", [self]() { + return self->serveFetchCheckpointParallelismLock.activePermits(); + }); + specialCounter(cc, "ServeFetchCheckpointWaiting", [self]() { + return self->serveFetchCheckpointParallelismLock.waiters(); + }); + specialCounter(cc, "ServeValidateStorageActive", [self]() { + return self->serveAuditStorageParallelismLock.activePermits(); + }); + specialCounter(cc, "ServeValidateStorageWaiting", [self]() { + return self->serveAuditStorageParallelismLock.waiters(); + }); + specialCounter(cc, "QueryQueueMax", [self]() { return self->getAndResetMaxQueryQueueSize(); }); + specialCounter(cc, "BytesStored", [self]() { return self->metrics.byteSample.getEstimate(allKeys); }); + specialCounter(cc, "ActiveWatches", [self]() { return self->numWatches; }); + specialCounter(cc, "WatchBytes", [self]() { return self->watchBytes; }); + specialCounter(cc, "KvstoreSizeTotal", [self]() { return std::get<0>(self->storage.getSize()); }); + specialCounter(cc, "KvstoreNodeTotal", [self]() { return std::get<1>(self->storage.getSize()); }); + specialCounter(cc, "KvstoreInlineKey", [self]() { return std::get<2>(self->storage.getSize()); }); + specialCounter(cc, "ActiveChangeFeeds", [self]() { return self->uidChangeFeed.size(); }); + specialCounter(cc, "ActiveChangeFeedQueries", [self]() { return self->activeFeedQueries; }); + specialCounter(cc, "ChangeFeedMemoryBytes", [self]() { return self->changeFeedMemoryBytes; }); + } + } counters; + private: // versionedData contains sets and clears. @@ -1311,234 +1540,6 @@ struct StorageServer : public IStorageMetricsService { Reference const> db; Database cx; - struct Counters { - CounterCollection cc; - Counter allQueries, systemKeyQueries, getKeyQueries, getValueQueries, getRangeQueries, getRangeSystemKeyQueries, - getRangeStreamQueries, finishedQueries, lowPriorityQueries, rowsQueried, bytesQueried, watchQueries, - emptyQueries, feedRowsQueried, feedBytesQueried, feedStreamQueries, rejectedFeedStreamQueries, - feedVersionQueries; - - // counters related to getMappedRange queries - Counter getMappedRangeBytesQueried, finishedGetMappedRangeSecondaryQueries, getMappedRangeQueries, - finishedGetMappedRangeQueries; - - // Bytes of the mutations that have been added to the memory of the storage server. When the data is durable - // and cleared from the memory, we do not subtract it but add it to bytesDurable. - Counter bytesInput; - // Bytes pulled from TLogs, it counts the size of the key value pairs, e.g., key-value pair ("a", "b") is - // counted as 2 Bytes. - Counter logicalBytesInput; - // Bytes pulled from TLogs for moving-in shards, it counts the mutations sent to the moving-in shard during - // Fetching and Waiting phases. - Counter logicalBytesMoveInOverhead; - // Bytes committed to the underlying storage engine by SS, it counts the size of key value pairs. - Counter kvCommitLogicalBytes; - // Count of all clearRange operations to the storage engine. - Counter kvClearRanges; - // Count of all clearRange operations on a singlekeyRange(key delete) to the storage engine. - Counter kvClearSingleKey; - // ClearRange operations issued by FDB, instead of from users, e.g., ClearRange operations to remove a shard - // from a storage server, as in removeDataRange(). - Counter kvSystemClearRanges; - // Bytes of the mutations that have been removed from memory because they durable. The counting is same as - // bytesInput, instead of the actual bytes taken in the storages, so that (bytesInput - bytesDurable) can - // reflect the current memory footprint of MVCC. - Counter bytesDurable; - // Bytes fetched by fetchKeys() for data movements. The size is counted as a collection of KeyValueRef. - Counter bytesFetched; - // Like bytesInput but without MVCC accounting. The size is counted as how much it takes when serialized. It - // is basically the size of both parameters of the mutation and a 12 bytes overhead that keeps mutation type - // and the lengths of both parameters. - Counter mutationBytes; - // Count of all fetchKey clearRange operations to the storage engine. - Counter kvClearRangesInFetchKeys; - - // Bytes fetched by fetchChangeFeed for data movements. - Counter feedBytesFetched; - - Counter sampledBytesCleared; - // The number of key-value pairs fetched by fetchKeys() - Counter kvFetched; - Counter mutations, setMutations, clearRangeMutations, atomicMutations, changeFeedMutations, - changeFeedMutationsDurable; - Counter updateBatches, updateVersions; - Counter loops; - Counter fetchWaitingMS, fetchWaitingCount, fetchExecutingMS, fetchExecutingCount; - Counter readsRejected; - Counter wrongShardServer; - Counter fetchedVersions; - Counter fetchesFromLogs; - // The following counters measure how many of lookups in the getMappedRangeQueries are effective. "Miss" - // means fallback if fallback is enabled, otherwise means failure (so that another layer could implement - // fallback). - Counter quickGetValueHit, quickGetValueMiss, quickGetKeyValuesHit, quickGetKeyValuesMiss; - - // The number of logical bytes returned from storage engine, in response to readRange operations. - Counter kvScanBytes; - // The number of logical bytes returned from storage engine, in response to readValue operations. - Counter kvGetBytes; - // The number of keys read from storage engine by eagerReads. - Counter eagerReadsKeys; - // The count of readValue operation to the storage engine. - Counter kvGets; - // The count of readValue operation to the storage engine. - Counter kvScans; - // The count of commit operation to the storage engine. - Counter kvCommits; - // The count of change feed reads that hit disk - Counter changeFeedDiskReads; - // The count of ChangeServerKeys actions. - Counter changeServerKeysAssigned; - Counter changeServerKeysUnassigned; - - // The count of 'set' inserted to pTree. The actual ptree.insert() number could be higher, because of the range - // clear split, see metric pTreeClearSplits. - Counter pTreeSets; - // The count of clear range inserted to pTree - Counter pTreeClears; - // If set is within a range of clear, the clear is split. It's tracking the number of splits, the split could be - // expensive. - Counter pTreeClearSplits; - - LatencySample readLatencySample; - LatencySample readKeyLatencySample; - LatencySample readValueLatencySample; - LatencySample readRangeLatencySample; - LatencySample readVersionWaitSample; - LatencySample readQueueWaitSample; - LatencySample kvReadRangeLatencySample; - LatencySample updateLatencySample; - - LatencyBands readLatencyBands; - LatencySample mappedRangeSample; // Samples getMappedRange latency - LatencySample mappedRangeRemoteSample; // Samples getMappedRange remote subquery latency - LatencySample mappedRangeLocalSample; // Samples getMappedRange local subquery latency - - Counters(StorageServer* self) - : cc("StorageServer", self->thisServerID.toString()), allQueries("QueryQueue", cc), - systemKeyQueries("SystemKeyQueries", cc), getKeyQueries("GetKeyQueries", cc), - getValueQueries("GetValueQueries", cc), getRangeQueries("GetRangeQueries", cc), - getRangeSystemKeyQueries("GetRangeSystemKeyQueries", cc), - getMappedRangeQueries("GetMappedRangeQueries", cc), getRangeStreamQueries("GetRangeStreamQueries", cc), - finishedQueries("FinishedQueries", cc), lowPriorityQueries("LowPriorityQueries", cc), - rowsQueried("RowsQueried", cc), bytesQueried("BytesQueried", cc), watchQueries("WatchQueries", cc), - emptyQueries("EmptyQueries", cc), feedRowsQueried("FeedRowsQueried", cc), - feedBytesQueried("FeedBytesQueried", cc), feedStreamQueries("FeedStreamQueries", cc), - rejectedFeedStreamQueries("RejectedFeedStreamQueries", cc), feedVersionQueries("FeedVersionQueries", cc), - bytesInput("BytesInput", cc), logicalBytesInput("LogicalBytesInput", cc), - logicalBytesMoveInOverhead("LogicalBytesMoveInOverhead", cc), - kvCommitLogicalBytes("KVCommitLogicalBytes", cc), kvClearRanges("KVClearRanges", cc), - kvClearSingleKey("KVClearSingleKey", cc), kvSystemClearRanges("KVSystemClearRanges", cc), - bytesDurable("BytesDurable", cc), bytesFetched("BytesFetched", cc), mutationBytes("MutationBytes", cc), - feedBytesFetched("FeedBytesFetched", cc), sampledBytesCleared("SampledBytesCleared", cc), - kvFetched("KVFetched", cc), mutations("Mutations", cc), setMutations("SetMutations", cc), - clearRangeMutations("ClearRangeMutations", cc), atomicMutations("AtomicMutations", cc), - changeFeedMutations("ChangeFeedMutations", cc), - changeFeedMutationsDurable("ChangeFeedMutationsDurable", cc), updateBatches("UpdateBatches", cc), - updateVersions("UpdateVersions", cc), loops("Loops", cc), fetchWaitingMS("FetchWaitingMS", cc), - fetchWaitingCount("FetchWaitingCount", cc), fetchExecutingMS("FetchExecutingMS", cc), - fetchExecutingCount("FetchExecutingCount", cc), readsRejected("ReadsRejected", cc), - wrongShardServer("WrongShardServer", cc), fetchedVersions("FetchedVersions", cc), - fetchesFromLogs("FetchesFromLogs", cc), quickGetValueHit("QuickGetValueHit", cc), - quickGetValueMiss("QuickGetValueMiss", cc), quickGetKeyValuesHit("QuickGetKeyValuesHit", cc), - quickGetKeyValuesMiss("QuickGetKeyValuesMiss", cc), kvScanBytes("KVScanBytes", cc), - kvGetBytes("KVGetBytes", cc), eagerReadsKeys("EagerReadsKeys", cc), kvGets("KVGets", cc), - kvScans("KVScans", cc), kvCommits("KVCommits", cc), changeFeedDiskReads("ChangeFeedDiskReads", cc), - getMappedRangeBytesQueried("GetMappedRangeBytesQueried", cc), - finishedGetMappedRangeQueries("FinishedGetMappedRangeQueries", cc), - finishedGetMappedRangeSecondaryQueries("FinishedGetMappedRangeSecondaryQueries", cc), - pTreeSets("PTreeSets", cc), pTreeClears("PTreeClears", cc), pTreeClearSplits("PTreeClearSplits", cc), - changeServerKeysAssigned("ChangeServerKeysAssigned", cc), - changeServerKeysUnassigned("ChangeServerKeysUnassigned", cc), - kvClearRangesInFetchKeys("KvClearRangesInFetchKeys", cc), - readLatencySample("ReadLatencyMetrics", - self->thisServerID, - SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, - SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), - readKeyLatencySample("GetKeyMetrics", - self->thisServerID, - SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, - SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), - readValueLatencySample("GetValueMetrics", - self->thisServerID, - SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, - SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), - readRangeLatencySample("GetRangeMetrics", - self->thisServerID, - SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, - SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), - readVersionWaitSample("ReadVersionWaitMetrics", - self->thisServerID, - SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, - SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), - readQueueWaitSample("ReadQueueWaitMetrics", - self->thisServerID, - SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, - SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), - readLatencyBands("ReadLatencyBands", self->thisServerID, SERVER_KNOBS->STORAGE_LOGGING_DELAY), - mappedRangeSample("GetMappedRangeMetrics", - self->thisServerID, - SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, - SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), - mappedRangeRemoteSample("GetMappedRangeRemoteMetrics", - self->thisServerID, - SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, - SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), - mappedRangeLocalSample("GetMappedRangeLocalMetrics", - self->thisServerID, - SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, - SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), - kvReadRangeLatencySample("KVGetRangeMetrics", - self->thisServerID, - SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, - SERVER_KNOBS->LATENCY_SKETCH_ACCURACY), - updateLatencySample("UpdateLatencyMetrics", - self->thisServerID, - SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL, - SERVER_KNOBS->LATENCY_SKETCH_ACCURACY) { - specialCounter(cc, "LastTLogVersion", [self]() { return self->lastTLogVersion; }); - specialCounter(cc, "Version", [self]() { return self->version.get(); }); - specialCounter(cc, "StorageVersion", [self]() { return self->storageVersion(); }); - specialCounter(cc, "DurableVersion", [self]() { return self->durableVersion.get(); }); - specialCounter(cc, "DesiredOldestVersion", [self]() { return self->desiredOldestVersion.get(); }); - specialCounter(cc, "VersionLag", [self]() { return self->versionLag; }); - specialCounter(cc, "LocalRate", [self] { return int64_t(self->currentRate() * 100); }); - - specialCounter(cc, "BytesReadSampleCount", [self]() { return self->metrics.bytesReadSample.queue.size(); }); - specialCounter( - cc, "FetchKeysFetchActive", [self]() { return self->fetchKeysParallelismLock.activePermits(); }); - specialCounter(cc, "FetchKeysWaiting", [self]() { return self->fetchKeysParallelismLock.waiters(); }); - specialCounter(cc, "FetchKeysChangeFeedFetchActive", [self]() { - return self->fetchKeysParallelismChangeFeedLock.activePermits(); - }); - specialCounter(cc, "FetchKeysFullFetchWaiting", [self]() { - return self->fetchKeysParallelismChangeFeedLock.waiters(); - }); - specialCounter(cc, "ServeFetchCheckpointActive", [self]() { - return self->serveFetchCheckpointParallelismLock.activePermits(); - }); - specialCounter(cc, "ServeFetchCheckpointWaiting", [self]() { - return self->serveFetchCheckpointParallelismLock.waiters(); - }); - specialCounter(cc, "ServeValidateStorageActive", [self]() { - return self->serveAuditStorageParallelismLock.activePermits(); - }); - specialCounter(cc, "ServeValidateStorageWaiting", [self]() { - return self->serveAuditStorageParallelismLock.waiters(); - }); - specialCounter(cc, "QueryQueueMax", [self]() { return self->getAndResetMaxQueryQueueSize(); }); - specialCounter(cc, "BytesStored", [self]() { return self->metrics.byteSample.getEstimate(allKeys); }); - specialCounter(cc, "ActiveWatches", [self]() { return self->numWatches; }); - specialCounter(cc, "WatchBytes", [self]() { return self->watchBytes; }); - specialCounter(cc, "KvstoreSizeTotal", [self]() { return std::get<0>(self->storage.getSize()); }); - specialCounter(cc, "KvstoreNodeTotal", [self]() { return std::get<1>(self->storage.getSize()); }); - specialCounter(cc, "KvstoreInlineKey", [self]() { return std::get<2>(self->storage.getSize()); }); - specialCounter(cc, "ActiveChangeFeeds", [self]() { return self->uidChangeFeed.size(); }); - specialCounter(cc, "ActiveChangeFeedQueries", [self]() { return self->activeFeedQueries; }); - specialCounter(cc, "ChangeFeedMemoryBytes", [self]() { return self->changeFeedMemoryBytes; }); - } - } counters; - ActorCollection actors; CoalescedKeyRangeMap> byteSampleClears; From 29e1875c98a096db8a8a7a87a0c5b6f970ca8f37 Mon Sep 17 00:00:00 2001 From: Jonathan Klabunde Tomer Date: Fri, 21 Aug 2026 13:16:22 -0700 Subject: [PATCH 9/9] correct typos in CountedSectionTest --- fdbrpc/CountedSectionTest.actor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fdbrpc/CountedSectionTest.actor.cpp b/fdbrpc/CountedSectionTest.actor.cpp index 7b6d0b3333d..a513977a570 100644 --- a/fdbrpc/CountedSectionTest.actor.cpp +++ b/fdbrpc/CountedSectionTest.actor.cpp @@ -1,9 +1,9 @@ /* - * StatsTest.actor.cpp + * CountedSectionTest.actor.cpp * * This source file is part of the FoundationDB open source project * - * Copyright 2013-2022 Apple Inc. and the FoundationDB project authors + * Copyright 2026 Apple Inc. and the FoundationDB project authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ TEST_CASE("/fdbrpc/countedsection/uninterrupted") { return Void(); } -TEST_CASE("/fdbrpc/countedesction/interrupted") { +TEST_CASE("/fdbrpc/countedsection/interrupted") { state TestCounters tc; {