diff --git a/fdbserver/Ratekeeper.actor.cpp b/fdbserver/Ratekeeper.actor.cpp index 538bca997a..5657b2b7d4 100644 --- a/fdbserver/Ratekeeper.actor.cpp +++ b/fdbserver/Ratekeeper.actor.cpp @@ -473,8 +473,7 @@ 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), - lastBusiestCommitTagPick(0.0) { + SERVER_KNOBS->TARGET_DURABILITY_LAG_VERSIONS_BATCH) { tagThrottler = std::make_unique(db, id); expiredTagThrottleCleanup = recurring([this]() { ThrottleApi::expire(this->db.getReference()); }, SERVER_KNOBS->TAG_THROTTLE_EXPIRED_CLEANUP_INTERVAL); @@ -984,6 +983,17 @@ ACTOR Future ratekeeper(RatekeeperInterface rkInterf, ReferenceSMOOTHING_AMOUNT), + smoothInputBytes(SERVER_KNOBS->SMOOTHING_AMOUNT), verySmoothDurableBytes(SERVER_KNOBS->SLOW_SMOOTHING_AMOUNT), + smoothDurableVersion(SERVER_KNOBS->SMOOTHING_AMOUNT), smoothLatestVersion(SERVER_KNOBS->SMOOTHING_AMOUNT), + smoothFreeSpace(SERVER_KNOBS->SMOOTHING_AMOUNT), smoothTotalSpace(SERVER_KNOBS->SMOOTHING_AMOUNT), + limitReason(limitReason_t::unlimited), + busiestWriteTagEventHolder(makeReference(id.toString() + "/BusiestWriteTag")) { + // FIXME: this is a tacky workaround for a potential uninitialized use in trackStorageServerQueueInfo + lastReply.instanceID = -1; +} + void StorageQueueInfo::refreshCommitCost(double elapsed) { busiestWriteTags.clear(); TransactionTag busiestTag; @@ -1018,3 +1028,31 @@ void StorageQueueInfo::refreshCommitCost(double elapsed) { totalWriteOps = 0; totalWriteCosts = 0; } + +TLogQueueInfo::TLogQueueInfo(UID id) + : valid(false), id(id), smoothDurableBytes(SERVER_KNOBS->SMOOTHING_AMOUNT), + smoothInputBytes(SERVER_KNOBS->SMOOTHING_AMOUNT), verySmoothDurableBytes(SERVER_KNOBS->SLOW_SMOOTHING_AMOUNT), + smoothFreeSpace(SERVER_KNOBS->SMOOTHING_AMOUNT), smoothTotalSpace(SERVER_KNOBS->SMOOTHING_AMOUNT) { + // FIXME: this is a tacky workaround for a potential uninitialized use in trackTLogQueueInfo (copied from + // storageQueueInfO) + lastReply.instanceID = -1; +} + +RatekeeperLimits::RatekeeperLimits(TransactionPriority priority, + std::string context, + int64_t storageTargetBytes, + int64_t storageSpringBytes, + int64_t logTargetBytes, + int64_t logSpringBytes, + double maxVersionDifference, + int64_t durabilityLagTargetVersions) + : tpsLimit(std::numeric_limits::infinity()), tpsLimitMetric(StringRef("Ratekeeper.TPSLimit" + context)), + reasonMetric(StringRef("Ratekeeper.Reason" + context)), storageTargetBytes(storageTargetBytes), + storageSpringBytes(storageSpringBytes), logTargetBytes(logTargetBytes), logSpringBytes(logSpringBytes), + maxVersionDifference(maxVersionDifference), + durabilityLagTargetVersions( + durabilityLagTargetVersions + + SERVER_KNOBS->MAX_READ_TRANSACTION_LIFE_VERSIONS), // The read transaction life versions are expected to not + // be durable on the storage servers + lastDurabilityLag(0), durabilityLagLimit(std::numeric_limits::infinity()), priority(priority), + context(context), rkUpdateEventCacheHolder(makeReference("RkUpdate" + context)) {} diff --git a/fdbserver/Ratekeeper.h b/fdbserver/Ratekeeper.h index 97037a2a63..2ac8b4c449 100644 --- a/fdbserver/Ratekeeper.h +++ b/fdbserver/Ratekeeper.h @@ -66,16 +66,7 @@ struct StorageQueueInfo { uint64_t totalWriteCosts = 0; int totalWriteOps = 0; - StorageQueueInfo(UID id, LocalityData locality) - : valid(false), id(id), locality(locality), smoothDurableBytes(SERVER_KNOBS->SMOOTHING_AMOUNT), - smoothInputBytes(SERVER_KNOBS->SMOOTHING_AMOUNT), verySmoothDurableBytes(SERVER_KNOBS->SLOW_SMOOTHING_AMOUNT), - smoothDurableVersion(SERVER_KNOBS->SMOOTHING_AMOUNT), smoothLatestVersion(SERVER_KNOBS->SMOOTHING_AMOUNT), - smoothFreeSpace(SERVER_KNOBS->SMOOTHING_AMOUNT), smoothTotalSpace(SERVER_KNOBS->SMOOTHING_AMOUNT), - limitReason(limitReason_t::unlimited), - busiestWriteTagEventHolder(makeReference(id.toString() + "/BusiestWriteTag")) { - // FIXME: this is a tacky workaround for a potential uninitialized use in trackStorageServerQueueInfo - lastReply.instanceID = -1; - } + StorageQueueInfo(UID id, LocalityData locality); void refreshCommitCost(double elapsed); }; @@ -88,14 +79,7 @@ struct TLogQueueInfo { Smoother smoothDurableBytes, smoothInputBytes, verySmoothDurableBytes; Smoother smoothFreeSpace; Smoother smoothTotalSpace; - TLogQueueInfo(UID id) - : valid(false), id(id), smoothDurableBytes(SERVER_KNOBS->SMOOTHING_AMOUNT), - smoothInputBytes(SERVER_KNOBS->SMOOTHING_AMOUNT), verySmoothDurableBytes(SERVER_KNOBS->SLOW_SMOOTHING_AMOUNT), - smoothFreeSpace(SERVER_KNOBS->SMOOTHING_AMOUNT), smoothTotalSpace(SERVER_KNOBS->SMOOTHING_AMOUNT) { - // FIXME: this is a tacky workaround for a potential uninitialized use in trackTLogQueueInfo (copied from - // storageQueueInfO) - lastReply.instanceID = -1; - } + TLogQueueInfo(UID id); }; struct RatekeeperLimits { @@ -125,17 +109,7 @@ struct RatekeeperLimits { int64_t logTargetBytes, int64_t logSpringBytes, double maxVersionDifference, - int64_t durabilityLagTargetVersions) - : tpsLimit(std::numeric_limits::infinity()), tpsLimitMetric(StringRef("Ratekeeper.TPSLimit" + context)), - reasonMetric(StringRef("Ratekeeper.Reason" + context)), storageTargetBytes(storageTargetBytes), - storageSpringBytes(storageSpringBytes), logTargetBytes(logTargetBytes), logSpringBytes(logSpringBytes), - maxVersionDifference(maxVersionDifference), - durabilityLagTargetVersions( - durabilityLagTargetVersions + - SERVER_KNOBS->MAX_READ_TRANSACTION_LIFE_VERSIONS), // The read transaction life versions are expected to not - // be durable on the storage servers - lastDurabilityLag(0), durabilityLagLimit(std::numeric_limits::infinity()), priority(priority), - context(context), rkUpdateEventCacheHolder(makeReference("RkUpdate" + context)) {} + int64_t durabilityLagTargetVersions); }; class Ratekeeper { @@ -143,16 +117,12 @@ class Ratekeeper { // Differentiate from GrvProxyInfo in DatabaseContext.h struct GrvProxyInfo { - int64_t totalTransactions; - int64_t batchTransactions; - uint64_t lastThrottledTagChangeId; + int64_t totalTransactions{ 0 }; + int64_t batchTransactions{ 0 }; + uint64_t lastThrottledTagChangeId{ 0 }; - double lastUpdateTime; - double lastTagPushTime; - - GrvProxyInfo() - : totalTransactions(0), batchTransactions(0), lastThrottledTagChangeId(0), lastUpdateTime(0), - lastTagPushTime(0) {} + double lastUpdateTime{ 0.0 }; + double lastTagPushTime{ 0.0 }; }; UID id;