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

Method addReadConflictRange

fdbclient/NativeAPI.actor.cpp:5587–5611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5585}
5586
5587void Transaction::addReadConflictRange(KeyRangeRef const& keys) {
5588 ASSERT(!keys.empty());
5589
5590 // There aren't any keys in the database with size larger than the max key size, so if range contains large keys
5591 // we can translate it to an equivalent one with smaller keys
5592 KeyRef begin = keys.begin;
5593 KeyRef end = keys.end;
5594
5595 int64_t beginMaxSize = getMaxReadKeySize(begin);
5596 int64_t endMaxSize = getMaxReadKeySize(end);
5597 if (begin.size() > beginMaxSize) {
5598 begin = begin.substr(0, beginMaxSize + 1);
5599 }
5600 if (end.size() > endMaxSize) {
5601 end = end.substr(0, endMaxSize + 1);
5602 }
5603
5604 KeyRangeRef r = KeyRangeRef(begin, end);
5605
5606 if (r.empty()) {
5607 return;
5608 }
5609
5610 tr.transaction.read_conflict_ranges.push_back_deep(tr.arena, r);
5611}
5612
5613void Transaction::makeSelfConflicting() {
5614 BinaryWriter wr(Unversioned());

Callers

nothing calls this directly

Calls 6

getMaxReadKeySizeFunction · 0.85
substrMethod · 0.80
KeyRangeRefClass · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
push_back_deepMethod · 0.45

Tested by

no test coverage detected