From 796249e99d6b467fe587b714f33b89ef5328cb86 Mon Sep 17 00:00:00 2001 From: sfc-gh-tclinkenbeard Date: Mon, 14 Feb 2022 16:15:51 -0800 Subject: [PATCH] Move lastBusiestCommitTagPick field back to Ratekeeper --- fdbserver/Ratekeeper.actor.cpp | 11 ++++++----- fdbserver/Ratekeeper.h | 2 ++ fdbserver/TagThrottler.h | 7 +------ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/fdbserver/Ratekeeper.actor.cpp b/fdbserver/Ratekeeper.actor.cpp index ed8b3f8d56..55388a9ba6 100644 --- a/fdbserver/Ratekeeper.actor.cpp +++ b/fdbserver/Ratekeeper.actor.cpp @@ -462,7 +462,8 @@ Ratekeeper::Ratekeeper(UID id, Database db) SERVER_KNOBS->TARGET_BYTES_PER_TLOG_BATCH, SERVER_KNOBS->SPRING_BYTES_TLOG_BATCH, SERVER_KNOBS->MAX_TL_SS_VERSION_DIFFERENCE_BATCH, - SERVER_KNOBS->TARGET_DURABILITY_LAG_VERSIONS_BATCH) { + SERVER_KNOBS->TARGET_DURABILITY_LAG_VERSIONS_BATCH), + lastBusiestCommitTagPick(0.0) { tagThrottler = std::make_unique(this); expiredTagThrottleCleanup = recurring([this]() { ThrottleApi::expire(this->db.getReference()); }, SERVER_KNOBS->TAG_THROTTLE_EXPIRED_CLEANUP_INTERVAL); @@ -964,11 +965,11 @@ void Ratekeeper::updateRate(RatekeeperLimits* limits) { } Future Ratekeeper::refreshStorageServerCommitCost() { - if (tagThrottler->getLastBusiestCommitTagPick() == 0) { // the first call should be skipped - tagThrottler->updateLastBusiestCommitTagPick(); + if (lastBusiestCommitTagPick == 0) { // the first call should be skipped + lastBusiestCommitTagPick = now(); return Void(); } - double elapsed = now() - tagThrottler->getLastBusiestCommitTagPick(); + double elapsed = now() - lastBusiestCommitTagPick; // for each SS, select the busiest commit tag from ssTrTagCommitCost for (auto it = storageQueueInfo.begin(); it != storageQueueInfo.end(); ++it) { it->value.busiestWriteTag.reset(); @@ -1006,7 +1007,7 @@ Future Ratekeeper::refreshStorageServerCommitCost() { it->value.totalWriteOps = 0; it->value.totalWriteCosts = 0; } - tagThrottler->updateLastBusiestCommitTagPick(); + lastBusiestCommitTagPick = now(); return Void(); } diff --git a/fdbserver/Ratekeeper.h b/fdbserver/Ratekeeper.h index ce3f170173..070b4b2d5b 100644 --- a/fdbserver/Ratekeeper.h +++ b/fdbserver/Ratekeeper.h @@ -181,6 +181,8 @@ struct Ratekeeper { Future expiredTagThrottleCleanup; + double lastBusiestCommitTagPick; + Ratekeeper(UID id, Database db); Future configurationMonitor(); diff --git a/fdbserver/TagThrottler.h b/fdbserver/TagThrottler.h index f555f2200f..3909097769 100644 --- a/fdbserver/TagThrottler.h +++ b/fdbserver/TagThrottler.h @@ -386,11 +386,10 @@ class TagThrottler { Ratekeeper* ratekeeper; RkTagThrottleCollection throttledTags; uint64_t throttledTagChangeId{ 0 }; - double lastBusiestCommitTagPick; bool autoThrottlingEnabled{ false }; public: - TagThrottler(Ratekeeper* ratekeeper) : ratekeeper(ratekeeper), lastBusiestCommitTagPick(0.0) {} + TagThrottler(Ratekeeper* ratekeeper) : ratekeeper(ratekeeper) {} Future monitorThrottlingChanges(); void addRequests(TransactionTag tag, int count) { throttledTags.addRequests(tag, count); } uint64_t getThrottledTagChangeId() const { return throttledTagChangeId; } @@ -405,8 +404,4 @@ public: Optional autoThrottleTag(UID id, TransactionTag tag, double busyness) { return throttledTags.autoThrottleTag(id, tag, busyness); } - - void updateLastBusiestCommitTagPick() { lastBusiestCommitTagPick = now(); } - - double getLastBusiestCommitTagPick() const { return lastBusiestCommitTagPick; } };