Use structured bindings for for loop in Ratekeeper::refreshStorageServerCommitCost
This commit is contained in:
parent
cad106f9eb
commit
455b75abca
|
@ -971,12 +971,12 @@ Future<Void> Ratekeeper::refreshStorageServerCommitCost() {
|
||||||
}
|
}
|
||||||
double elapsed = now() - lastBusiestCommitTagPick;
|
double elapsed = now() - lastBusiestCommitTagPick;
|
||||||
// for each SS, select the busiest commit tag from ssTrTagCommitCost
|
// for each SS, select the busiest commit tag from ssTrTagCommitCost
|
||||||
for (auto it = storageQueueInfo.begin(); it != storageQueueInfo.end(); ++it) {
|
for (auto& [ssId, ssQueueInfo] : storageQueueInfo) {
|
||||||
it->value.busiestWriteTags.clear();
|
ssQueueInfo.busiestWriteTags.clear();
|
||||||
TransactionTag busiestTag;
|
TransactionTag busiestTag;
|
||||||
TransactionCommitCostEstimation maxCost;
|
TransactionCommitCostEstimation maxCost;
|
||||||
double maxRate = 0, maxBusyness = 0;
|
double maxRate = 0, maxBusyness = 0;
|
||||||
for (const auto& [tag, cost] : it->value.tagCostEst) {
|
for (const auto& [tag, cost] : ssQueueInfo.tagCostEst) {
|
||||||
double rate = cost.getCostSum() / elapsed;
|
double rate = cost.getCostSum() / elapsed;
|
||||||
if (rate > maxRate) {
|
if (rate > maxRate) {
|
||||||
busiestTag = tag;
|
busiestTag = tag;
|
||||||
|
@ -986,24 +986,24 @@ Future<Void> Ratekeeper::refreshStorageServerCommitCost() {
|
||||||
}
|
}
|
||||||
if (maxRate > SERVER_KNOBS->MIN_TAG_WRITE_PAGES_RATE) {
|
if (maxRate > SERVER_KNOBS->MIN_TAG_WRITE_PAGES_RATE) {
|
||||||
// TraceEvent("RefreshSSCommitCost").detail("TotalWriteCost", it->value.totalWriteCost).detail("TotalWriteOps",it->value.totalWriteOps);
|
// TraceEvent("RefreshSSCommitCost").detail("TotalWriteCost", it->value.totalWriteCost).detail("TotalWriteOps",it->value.totalWriteOps);
|
||||||
ASSERT_GT(it->value.totalWriteCosts, 0);
|
ASSERT_GT(ssQueueInfo.totalWriteCosts, 0);
|
||||||
maxBusyness = double(maxCost.getCostSum()) / it->value.totalWriteCosts;
|
maxBusyness = double(maxCost.getCostSum()) / ssQueueInfo.totalWriteCosts;
|
||||||
it->value.busiestWriteTags.emplace_back(busiestTag, maxBusyness, maxRate);
|
ssQueueInfo.busiestWriteTags.emplace_back(busiestTag, maxBusyness, maxRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
TraceEvent("BusiestWriteTag", it->key)
|
TraceEvent("BusiestWriteTag", ssId)
|
||||||
.detail("Elapsed", elapsed)
|
.detail("Elapsed", elapsed)
|
||||||
.detail("Tag", printable(busiestTag))
|
.detail("Tag", printable(busiestTag))
|
||||||
.detail("TagOps", maxCost.getOpsSum())
|
.detail("TagOps", maxCost.getOpsSum())
|
||||||
.detail("TagCost", maxCost.getCostSum())
|
.detail("TagCost", maxCost.getCostSum())
|
||||||
.detail("TotalCost", it->value.totalWriteCosts)
|
.detail("TotalCost", ssQueueInfo.totalWriteCosts)
|
||||||
.detail("Reported", !it->value.busiestWriteTags.empty())
|
.detail("Reported", !ssQueueInfo.busiestWriteTags.empty())
|
||||||
.trackLatest(it->value.busiestWriteTagEventHolder->trackingKey);
|
.trackLatest(ssQueueInfo.busiestWriteTagEventHolder->trackingKey);
|
||||||
|
|
||||||
// reset statistics
|
// reset statistics
|
||||||
it->value.tagCostEst.clear();
|
ssQueueInfo.tagCostEst.clear();
|
||||||
it->value.totalWriteOps = 0;
|
ssQueueInfo.totalWriteOps = 0;
|
||||||
it->value.totalWriteCosts = 0;
|
ssQueueInfo.totalWriteCosts = 0;
|
||||||
}
|
}
|
||||||
lastBusiestCommitTagPick = now();
|
lastBusiestCommitTagPick = now();
|
||||||
return Void();
|
return Void();
|
||||||
|
|
Loading…
Reference in New Issue