format code

This commit is contained in:
Xiaoxi Wang 2022-10-31 09:45:56 -07:00
parent d2ecc3cb48
commit 7442cfa2cb
5 changed files with 14 additions and 12 deletions

View File

@ -100,7 +100,7 @@ TEST_CASE("/KeyRangeUtil/randomKeyBetween") {
Key begin = "qwert"_sr;
Key end = "qwertyu"_sr;
Key res;
for(int i = 0; i < 10; ++ i) {
for (int i = 0; i < 10; ++i) {
res = randomKeyBetween(KeyRangeRef(begin, end));
ASSERT(res > begin);
ASSERT(res < end);
@ -113,7 +113,7 @@ TEST_CASE("/KeyRangeUtil/randomKeyBetween") {
begin = "aaaaaaa"_sr;
end = "b"_sr;
for(int i = 0; i < 10; ++ i) {
for (int i = 0; i < 10; ++i) {
res = randomKeyBetween(KeyRangeRef(begin, end));
ASSERT(res > begin);
ASSERT(res < end);

View File

@ -643,8 +643,8 @@ struct StorageMetrics {
static const int64_t infinity = 1LL << 60;
bool allLessOrEqual(const StorageMetrics& rhs) const {
return bytes <= rhs.bytes && writeBytesPerKSecond <= rhs.writeBytesPerKSecond && iosPerKSecond <= rhs.iosPerKSecond &&
bytesReadPerKSecond <= rhs.bytesReadPerKSecond;
return bytes <= rhs.bytes && writeBytesPerKSecond <= rhs.writeBytesPerKSecond &&
iosPerKSecond <= rhs.iosPerKSecond && bytesReadPerKSecond <= rhs.bytesReadPerKSecond;
}
void operator+=(const StorageMetrics& rhs) {
bytes += rhs.bytes;
@ -697,8 +697,8 @@ struct StorageMetrics {
}
bool operator==(StorageMetrics const& rhs) const {
return bytes == rhs.bytes && writeBytesPerKSecond == rhs.writeBytesPerKSecond && iosPerKSecond == rhs.iosPerKSecond &&
bytesReadPerKSecond == rhs.bytesReadPerKSecond;
return bytes == rhs.bytes && writeBytesPerKSecond == rhs.writeBytesPerKSecond &&
iosPerKSecond == rhs.iosPerKSecond && bytesReadPerKSecond == rhs.bytesReadPerKSecond;
}
std::string toString() const {

View File

@ -638,7 +638,8 @@ ACTOR Future<BlobGranuleSplitPoints> splitRange(Reference<BlobManagerData> bmDat
splitMetrics.bytes = SERVER_KNOBS->BG_SNAPSHOT_FILE_TARGET_BYTES;
splitMetrics.writeBytesPerKSecond = SERVER_KNOBS->SHARD_SPLIT_BYTES_PER_KSEC;
if (writeHot) {
splitMetrics.writeBytesPerKSecond = std::min(splitMetrics.writeBytesPerKSecond, estimated.writeBytesPerKSecond / 2);
splitMetrics.writeBytesPerKSecond =
std::min(splitMetrics.writeBytesPerKSecond, estimated.writeBytesPerKSecond / 2);
splitMetrics.writeBytesPerKSecond =
std::max(splitMetrics.writeBytesPerKSecond, SERVER_KNOBS->SHARD_MIN_BYTES_PER_KSEC);
}

View File

@ -99,7 +99,7 @@ void StorageServerMetrics::notify(KeyRef key, StorageMetrics& metrics) {
if (metrics.writeBytesPerKSecond)
notifyMetrics.writeBytesPerKSecond = bytesWriteSample.addAndExpire(key, metrics.writeBytesPerKSecond, expire) *
SERVER_KNOBS->STORAGE_METRICS_AVERAGE_INTERVAL_PER_KSECONDS;
SERVER_KNOBS->STORAGE_METRICS_AVERAGE_INTERVAL_PER_KSECONDS;
if (metrics.iosPerKSecond)
notifyMetrics.iosPerKSecond = iopsSample.addAndExpire(key, metrics.iosPerKSecond, expire) *
SERVER_KNOBS->STORAGE_METRICS_AVERAGE_INTERVAL_PER_KSECONDS;

View File

@ -10074,12 +10074,13 @@ ACTOR Future<Void> waitMetrics(StorageServerMetrics* self, WaitMetricsRequest re
// all the messages for one clear or set have been dispatched.
/*StorageMetrics m = getMetrics( data, req.keys );
bool b = ( m.bytes != metrics.bytes || m.writeBytesPerKSecond != metrics.writeBytesPerKSecond ||
m.iosPerKSecond != metrics.iosPerKSecond ); if (b) { printf("keys: '%s' - '%s' @%p\n",
bool b = ( m.bytes != metrics.bytes || m.writeBytesPerKSecond != metrics.writeBytesPerKSecond
|| m.iosPerKSecond != metrics.iosPerKSecond ); if (b) { printf("keys: '%s' - '%s' @%p\n",
printable(req.keys.begin).c_str(), printable(req.keys.end).c_str(), this);
printf("waitMetrics: desync %d (%lld %lld %lld) != (%lld %lld %lld); +(%lld %lld %lld)\n",
b, m.bytes, m.writeBytesPerKSecond, m.iosPerKSecond, metrics.bytes, metrics.writeBytesPerKSecond,
metrics.iosPerKSecond, c.bytes, c.writeBytesPerKSecond, c.iosPerKSecond);
b, m.bytes, m.writeBytesPerKSecond, m.iosPerKSecond, metrics.bytes,
metrics.writeBytesPerKSecond, metrics.iosPerKSecond, c.bytes, c.writeBytesPerKSecond,
c.iosPerKSecond);
}*/
}