Merge pull request #8197 from sfc-gh-jslocum/bg_code_coverage_cleanup

cleaning tss and blob granule file code probes
This commit is contained in:
Trevor Clinkenbeard 2022-09-16 09:32:20 -07:00 committed by GitHub
commit 7b4598a53d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 69 deletions

View File

@ -1088,65 +1088,6 @@ ParsedDeltaBoundaryRef deltaAtVersion(const DeltaBoundaryRef& delta, Version beg
}
}
void applyDeltasSorted(const Standalone<VectorRef<ParsedDeltaBoundaryRef>>& sortedDeltas,
bool startClear,
std::map<KeyRef, ValueRef>& dataMap) {
if (sortedDeltas.empty() && !startClear) {
return;
}
// sorted merge of 2 iterators
bool prevClear = startClear;
auto deltaIt = sortedDeltas.begin();
auto snapshotIt = dataMap.begin();
while (deltaIt != sortedDeltas.end() && snapshotIt != dataMap.end()) {
if (deltaIt->key < snapshotIt->first) {
// Delta is lower than snapshot. Insert new row, if the delta is a set. Ignore point clear and noop
if (deltaIt->isSet()) {
snapshotIt = dataMap.insert(snapshotIt, { deltaIt->key, deltaIt->value });
snapshotIt++;
}
prevClear = deltaIt->clearAfter;
deltaIt++;
} else if (snapshotIt->first < deltaIt->key) {
// Snapshot is lower than delta. Erase the current entry if the previous delta was a clearAfter
if (prevClear) {
snapshotIt = dataMap.erase(snapshotIt);
} else {
snapshotIt++;
}
} else {
// Delta and snapshot are for the same key. The delta is newer, so if it is a set, update the value, else if
// it's a clear, delete the value (ignore noop)
if (deltaIt->isSet()) {
snapshotIt->second = deltaIt->value;
} else if (deltaIt->isClear()) {
snapshotIt = dataMap.erase(snapshotIt);
}
if (!deltaIt->isClear()) {
snapshotIt++;
}
prevClear = deltaIt->clearAfter;
deltaIt++;
}
}
// Either we are out of deltas or out of snapshots.
// if snapshot remaining and prevClear last delta set, clear the rest of the map
if (prevClear && snapshotIt != dataMap.end()) {
CODE_PROBE(true, "last delta range cleared end of snapshot");
dataMap.erase(snapshotIt, dataMap.end());
}
// Apply remaining sets from delta, with no remaining snapshot
while (deltaIt != sortedDeltas.end()) {
if (deltaIt->isSet()) {
CODE_PROBE(true, "deltas past end of snapshot");
snapshotIt = dataMap.insert(snapshotIt, { deltaIt->key, deltaIt->value });
}
deltaIt++;
}
}
// The arena owns the BoundaryDeltaRef struct data but the StringRef pointers point to data in deltaData, to avoid extra
// copying
Standalone<VectorRef<ParsedDeltaBoundaryRef>> loadChunkedDeltaFile(const Standalone<StringRef>& fileNameRef,
@ -2214,7 +2155,6 @@ Standalone<GranuleSnapshot> genSnapshot(KeyValueGen& kvGen, int targetDataBytes)
while (totalDataBytes < targetDataBytes) {
Optional<StringRef> key = kvGen.newKey();
if (!key.present()) {
CODE_PROBE(true, "snapshot unit test keyspace full");
break;
}
StringRef value = kvGen.value();

View File

@ -170,14 +170,8 @@ void DatabaseContext::addTssMapping(StorageServerInterface const& ssi, StorageSe
tssMetrics[tssi.id()] = metrics;
tssMapping[ssi.id()] = tssi;
} else {
if (result->second.id() == tssi.id()) {
ASSERT(result->second.id() == tssi.id());
metrics = tssMetrics[tssi.id()];
} else {
CODE_PROBE(true, "SS now maps to new TSS! This will probably never happen in practice");
tssMetrics.erase(result->second.id());
metrics = makeReference<TSSMetrics>();
tssMetrics[tssi.id()] = metrics;
}
result->second = tssi;
}
@ -4680,7 +4674,6 @@ static Future<Void> tssStreamComparison(Request request,
// FIXME: this code is pretty much identical to LoadBalance.h
// TODO could add team check logic in if we added synchronous way to turn this into a fixed getRange request
// and send it to the whole team and compare? I think it's fine to skip that for streaming though
CODE_PROBE(ssEndOfStream != tssEndOfStream, "SS or TSS stream finished early!");
// skip tss comparison if both are end of stream
if ((!ssEndOfStream || !tssEndOfStream) && !TSS_doCompare(ssReply.get(), tssReply.get())) {