MCPcopy Create free account
hub / github.com/apple/foundationdb / filterLogMutationKVPairs

Function filterLogMutationKVPairs

fdbclient/FileBackupAgent.actor.cpp:3353–3373  ·  view source on GitHub ↗

Returns a vector of filtered KV refs from data which are either part of incomplete mutation groups OR complete and have data relevant to one of the KV ranges in ranges

Source from the content-addressed store, hash-verified

3351// Returns a vector of filtered KV refs from data which are either part of incomplete mutation groups OR complete
3352// and have data relevant to one of the KV ranges in ranges
3353std::vector<KeyValueRef> filterLogMutationKVPairs(VectorRef<KeyValueRef> data, const std::vector<KeyRange>& ranges) {
3354 std::unordered_map<Version, AccumulatedMutations> mutationBlocksByVersion;
3355
3356 for (auto& kv : data) {
3357 auto versionAndChunkNumber = decodeMutationLogKey(kv.key);
3358 mutationBlocksByVersion[versionAndChunkNumber.first].addChunk(versionAndChunkNumber.second, kv);
3359 }
3360
3361 std::vector<KeyValueRef> output;
3362
3363 for (auto& vb : mutationBlocksByVersion) {
3364 AccumulatedMutations& m = vb.second;
3365
3366 // If the mutations are incomplete or match one of the ranges, include in results.
3367 if (!m.isComplete() || m.matchesAnyRange(ranges)) {
3368 output.insert(output.end(), m.kvs.begin(), m.kvs.end());
3369 }
3370 }
3371
3372 return output;
3373}
3374struct RestoreLogDataTaskFunc : RestoreFileTaskFuncBase {
3375 static StringRef name;
3376 static constexpr uint32_t version = 1;

Callers 1

Calls 7

decodeMutationLogKeyFunction · 0.85
addChunkMethod · 0.80
matchesAnyRangeMethod · 0.80
isCompleteMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected