Addressed review comments

This commit is contained in:
sfc-gh-tclinkenbeard 2022-08-10 21:44:12 -03:00
parent 5608dfc5bb
commit 66373f1e74
4 changed files with 12 additions and 24 deletions

View File

@ -437,7 +437,7 @@ public:
void addRequests(TransactionTag tag, int count) { tagStatistics[tag].addTransactions(static_cast<double>(count)); }
uint64_t getThrottledTagChangeId() const { return throttledTagChangeId; }
PrioritizedTransactionTagMap<double> getRates() {
PrioritizedTransactionTagMap<double> getProxyRates(int numProxies) {
PrioritizedTransactionTagMap<double> result;
lastBusyReadTagCount = lastBusyWriteTagCount = 0;
statusReply = {};
@ -455,7 +455,8 @@ public:
}
if (targetTps.present()) {
auto const smoothedTargetTps = stats.updateAndGetTargetLimit(targetTps.get());
result[TransactionPriority::BATCH][tag] = result[TransactionPriority::DEFAULT][tag] = smoothedTargetTps;
result[TransactionPriority::BATCH][tag] = result[TransactionPriority::DEFAULT][tag] =
smoothedTargetTps / numProxies;
} else {
te.disable();
}
@ -543,8 +544,8 @@ uint64_t GlobalTagThrottler::getThrottledTagChangeId() const {
PrioritizedTransactionTagMap<ClientTagThrottleLimits> GlobalTagThrottler::getClientRates() {
return impl->getClientRates();
}
PrioritizedTransactionTagMap<double> GlobalTagThrottler::getRates() {
return impl->getRates();
PrioritizedTransactionTagMap<double> GlobalTagThrottler::getProxyRates(int numProxies) {
return impl->getProxyRates(numProxies);
}
int64_t GlobalTagThrottler::autoThrottleCount() const {
return impl->autoThrottleCount();
@ -728,7 +729,7 @@ bool isNear(Optional<double> a, Optional<double> b) {
bool targetRateIsNear(GlobalTagThrottler& globalTagThrottler, TransactionTag tag, Optional<double> expected) {
Optional<double> rate;
auto targetRates = globalTagThrottler.getRates();
auto targetRates = globalTagThrottler.getProxyRates(1);
auto it1 = targetRates.find(TransactionPriority::DEFAULT);
if (it1 != targetRates.end()) {
auto it2 = it1->second.find(tag);

View File

@ -324,15 +324,9 @@ public:
bool returningTagsToProxy{ false };
if (SERVER_KNOBS->ENFORCE_TAG_THROTTLING_ON_PROXIES) {
reply.proxyThrottledTags = self.tagThrottler->getRates();
if (reply.proxyThrottledTags.present()) {
for (auto& [priority, tagToRate] : reply.proxyThrottledTags.get()) {
for (auto& [tag, rate] : tagToRate) {
rate /= self.grvProxyInfo.size();
}
}
returningTagsToProxy = reply.proxyThrottledTags.get().size() > 0;
}
reply.proxyThrottledTags = self.tagThrottler->getProxyRates(self.grvProxyInfo.size());
returningTagsToProxy =
reply.proxyThrottledTags.present() && reply.proxyThrottledTags.get().size() > 0;
} else {
reply.clientThrottledTags = self.tagThrottler->getClientRates();
returningTagsToProxy =

View File

@ -175,10 +175,6 @@ public:
PrioritizedTransactionTagMap<ClientTagThrottleLimits> getClientRates() {
return throttledTags.getClientRates(autoThrottlingEnabled);
}
PrioritizedTransactionTagMap<double> getRates() const {
// TODO: Implement (currently not supported)
return {};
}
int64_t autoThrottleCount() const { return throttledTags.autoThrottleCount(); }
uint32_t busyReadTagCount() const { return throttledTags.getBusyReadTagCount(); }
uint32_t busyWriteTagCount() const { return throttledTags.getBusyWriteTagCount(); }
@ -224,9 +220,6 @@ uint64_t TagThrottler::getThrottledTagChangeId() const {
PrioritizedTransactionTagMap<ClientTagThrottleLimits> TagThrottler::getClientRates() {
return impl->getClientRates();
}
PrioritizedTransactionTagMap<double> TagThrottler::getRates() {
return impl->getRates();
}
int64_t TagThrottler::autoThrottleCount() const {
return impl->autoThrottleCount();
}

View File

@ -42,7 +42,7 @@ public:
// For each tag and priority combination, return the throughput limit for the cluster
// (to be shared across all GRV proxies)
virtual PrioritizedTransactionTagMap<double> getRates() = 0;
virtual PrioritizedTransactionTagMap<double> getProxyRates(int numProxies) = 0;
virtual int64_t autoThrottleCount() const = 0;
virtual uint32_t busyReadTagCount() const = 0;
@ -68,7 +68,7 @@ public:
void addRequests(TransactionTag tag, int count) override;
uint64_t getThrottledTagChangeId() const override;
PrioritizedTransactionTagMap<ClientTagThrottleLimits> getClientRates() override;
PrioritizedTransactionTagMap<double> getRates() override;
PrioritizedTransactionTagMap<double> getProxyRates(int numProxies) override { throw not_implemented(); }
int64_t autoThrottleCount() const override;
uint32_t busyReadTagCount() const override;
uint32_t busyWriteTagCount() const override;
@ -97,7 +97,7 @@ public:
Future<Void> tryUpdateAutoThrottling(StorageQueueInfo const&) override;
PrioritizedTransactionTagMap<ClientTagThrottleLimits> getClientRates() override;
PrioritizedTransactionTagMap<double> getRates() override;
PrioritizedTransactionTagMap<double> getProxyRates(int numProxies) override;
GlobalTagThrottlerStatusReply getGlobalTagThrottlerStatusReply() const override;