clang-format

This commit is contained in:
Chaoguang Lin 2020-05-18 14:23:17 -07:00
parent e3921504d7
commit 00dce3ca1d
4 changed files with 15 additions and 9 deletions

View File

@ -607,7 +607,8 @@ DatabaseContext::DatabaseContext(Reference<AsyncVar<Reference<ClusterConnectionF
registerSpecialKeySpaceModule(SpecialKeySpace::MODULE::TRANSACTION, std::make_unique<ConflictingKeysImpl>(conflictingKeysRange));
registerSpecialKeySpaceModule(SpecialKeySpace::MODULE::TRANSACTION, std::make_unique<ReadConflictRangeImpl>(readConflictRangeKeysRange));
registerSpecialKeySpaceModule(SpecialKeySpace::MODULE::TRANSACTION, std::make_unique<WriteConflictRangeImpl>(writeConflictRangeKeysRange));
registerSpecialKeySpaceModule(SpecialKeySpace::MODULE::METRICS, std::make_unique<DDStatsRangeImpl>(ddStatsRange));
registerSpecialKeySpaceModule(SpecialKeySpace::MODULE::METRICS,
std::make_unique<DDStatsRangeImpl>(ddStatsRange));
registerSpecialKeySpaceModule(SpecialKeySpace::MODULE::WORKERINTERFACE, std::make_unique<WorkerInterfacesSpecialKeyImpl>(KeyRangeRef(
LiteralStringRef("\xff\xff/worker_interfaces/"), LiteralStringRef("\xff\xff/worker_interfaces0"))));
registerSpecialKeySpaceModule(SpecialKeySpace::MODULE::STATUSJSON, std::make_unique<SingleSpecialKeyImpl>(

View File

@ -30,7 +30,8 @@ std::unordered_map<SpecialKeySpace::MODULE, KeyRange> SpecialKeySpace::moduleToB
{ SpecialKeySpace::MODULE::STATUSJSON, singleKeyRange(LiteralStringRef("\xff\xff/status/json")) },
{ SpecialKeySpace::MODULE::CONNECTIONSTRING, singleKeyRange(LiteralStringRef("\xff\xff/connection_string")) },
{ SpecialKeySpace::MODULE::CLUSTERFILEPATH, singleKeyRange(LiteralStringRef("\xff\xff/cluster_file_path")) },
{ SpecialKeySpace::MODULE::METRICS, KeyRangeRef(LiteralStringRef("\xff\xff/metrics/"), LiteralStringRef("\xff\xff/metrics0")) }
{ SpecialKeySpace::MODULE::METRICS,
KeyRangeRef(LiteralStringRef("\xff\xff/metrics/"), LiteralStringRef("\xff\xff/metrics0")) }
};
// This function will move the given KeySelector as far as possible to the standard form:
@ -314,7 +315,8 @@ Future<Standalone<RangeResultRef>> ConflictingKeysImpl::getRange(Reference<ReadY
return result;
}
ACTOR Future<Standalone<RangeResultRef>> ddStatsGetRangeActor(Reference<ReadYourWritesTransaction> ryw, KeyRangeRef kr) {
ACTOR Future<Standalone<RangeResultRef>> ddStatsGetRangeActor(Reference<ReadYourWritesTransaction> ryw,
KeyRangeRef kr) {
try {
auto keys = kr.removePrefix(ddStatsRange.begin);
Standalone<VectorRef<DDMetricsRef>> resultWithoutPrefix =
@ -335,7 +337,8 @@ ACTOR Future<Standalone<RangeResultRef>> ddStatsGetRangeActor(Reference<ReadYour
DDStatsRangeImpl::DDStatsRangeImpl(KeyRangeRef kr) : SpecialKeyRangeBaseImpl(kr) {}
Future<Standalone<RangeResultRef>> DDStatsRangeImpl::getRange(Reference<ReadYourWritesTransaction> ryw, KeyRangeRef kr) const {
Future<Standalone<RangeResultRef>> DDStatsRangeImpl::getRange(Reference<ReadYourWritesTransaction> ryw,
KeyRangeRef kr) const {
return ddStatsGetRangeActor(ryw, kr);
}

View File

@ -203,7 +203,8 @@ const KeyRangeRef writeConflictRangeKeysRange =
KeyRangeRef(LiteralStringRef("\xff\xff/transaction/write_conflict_range/"),
LiteralStringRef("\xff\xff/transaction/write_conflict_range/\xff\xff"));
const KeyRangeRef ddStatsRange = KeyRangeRef(LiteralStringRef("\xff\xff/metrics/dd_stats/"), LiteralStringRef("\xff\xff/metrics/dd_stats/\xff\xff"));
const KeyRangeRef ddStatsRange =
KeyRangeRef(LiteralStringRef("\xff\xff/metrics/dd_stats/"), LiteralStringRef("\xff\xff/metrics/dd_stats/\xff\xff"));
const ValueRef ddStatsZeroBytes = LiteralStringRef("0");
// "\xff/storageCache/[[begin]]" := "[[vector<uint16_t>]]"

View File

@ -66,7 +66,8 @@ struct DataDistributionMetricsWorkload : KVWorkload {
TraceEvent(SevError, "NoTransactionsCommitted");
return false;
}
Reference<ReadYourWritesTransaction> tr= Reference<ReadYourWritesTransaction>(new ReadYourWritesTransaction(cx));
Reference<ReadYourWritesTransaction> tr =
Reference<ReadYourWritesTransaction>(new ReadYourWritesTransaction(cx));
// ReadYourWritesTransaction tr(cx); // TODO : Debug if we use this one, delref(RYW) will throw error
try {
Standalone<RangeResultRef> result = wait(tr->getRange(ddStatsRange, 100));
@ -75,12 +76,12 @@ struct DataDistributionMetricsWorkload : KVWorkload {
self->numShards = result.size() / 2;
if (self->numShards < 1) return false;
int64_t totalBytes = 0;
for (int i = 0; i < result.size(); i+=2) {
for (int i = 0; i < result.size(); i += 2) {
// totalBytes += readJSONStrictly(kv.value.toString()).get_obj()["ShardBytes"].get_int64();
ASSERT(result[i].key.startsWith(ddStatsRange.begin));
totalBytes += std::stoi(result[i].value.toString());
ASSERT(result[i+1].key.startsWith(ddStatsRange.begin));
ASSERT(result[i+1].value == ddStatsZeroBytes);
ASSERT(result[i + 1].key.startsWith(ddStatsRange.begin));
ASSERT(result[i + 1].value == ddStatsZeroBytes);
}
self->avgBytes = totalBytes / self->numShards;
} catch (Error& e) {