Support throttling multiple tags in TagThrottler::tryUpdateAutoThrottling

This commit is contained in:
sfc-gh-tclinkenbeard 2022-04-02 13:29:34 -07:00
parent bfd145b299
commit 124527a668

View File

@ -187,23 +187,21 @@ public:
// the future // the future
auto storageQueue = ss.getStorageQueueBytes(); auto storageQueue = ss.getStorageQueueBytes();
auto storageDurabilityLag = ss.getDurabilityLag(); auto storageDurabilityLag = ss.getDurabilityLag();
std::vector<Future<Void>> futures;
if (storageQueue > SERVER_KNOBS->AUTO_TAG_THROTTLE_STORAGE_QUEUE_BYTES || if (storageQueue > SERVER_KNOBS->AUTO_TAG_THROTTLE_STORAGE_QUEUE_BYTES ||
storageDurabilityLag > SERVER_KNOBS->AUTO_TAG_THROTTLE_DURABILITY_LAG_VERSIONS) { storageDurabilityLag > SERVER_KNOBS->AUTO_TAG_THROTTLE_DURABILITY_LAG_VERSIONS) {
// TODO: Update once size is potentially > 1
ASSERT_WE_THINK(ss.busiestWriteTags.size() <= 1);
ASSERT_WE_THINK(ss.busiestReadTags.size() <= 1);
for (const auto& busyWriteTag : ss.busiestWriteTags) { for (const auto& busyWriteTag : ss.busiestWriteTags) {
return tryUpdateAutoThrottling(busyWriteTag.tag, futures.push_back(tryUpdateAutoThrottling(busyWriteTag.tag,
busyWriteTag.rate, busyWriteTag.rate,
busyWriteTag.fractionalBusyness, busyWriteTag.fractionalBusyness,
TagThrottledReason::BUSY_WRITE); TagThrottledReason::BUSY_WRITE));
} }
for (const auto& busyReadTag : ss.busiestReadTags) { for (const auto& busyReadTag : ss.busiestReadTags) {
return tryUpdateAutoThrottling( futures.push_back(tryUpdateAutoThrottling(
busyReadTag.tag, busyReadTag.rate, busyReadTag.fractionalBusyness, TagThrottledReason::BUSY_READ); busyReadTag.tag, busyReadTag.rate, busyReadTag.fractionalBusyness, TagThrottledReason::BUSY_READ));
} }
} }
return Void(); return waitForAll(futures);
} }
}; // class TagThrottlerImpl }; // class TagThrottlerImpl