MCPcopy Create free account
hub / github.com/ElementsProject/elements / ShouldStopBefore

Method ShouldStopBefore

src/leveldb/db/version_set.cc:1531–1553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1529}
1530
1531bool Compaction::ShouldStopBefore(const Slice& internal_key) {
1532 const VersionSet* vset = input_version_->vset_;
1533 // Scan to find earliest grandparent file that contains key.
1534 const InternalKeyComparator* icmp = &vset->icmp_;
1535 while (grandparent_index_ < grandparents_.size() &&
1536 icmp->Compare(internal_key,
1537 grandparents_[grandparent_index_]->largest.Encode()) >
1538 0) {
1539 if (seen_key_) {
1540 overlapped_bytes_ += grandparents_[grandparent_index_]->file_size;
1541 }
1542 grandparent_index_++;
1543 }
1544 seen_key_ = true;
1545
1546 if (overlapped_bytes_ > MaxGrandParentOverlapBytes(vset->options_)) {
1547 // Too much overlap for current output; start new output
1548 overlapped_bytes_ = 0;
1549 return true;
1550 } else {
1551 return false;
1552 }
1553}
1554
1555void Compaction::ReleaseInputs() {
1556 if (input_version_ != nullptr) {

Callers 1

DoCompactionWorkMethod · 0.80

Calls 4

sizeMethod · 0.45
CompareMethod · 0.45
EncodeMethod · 0.45

Tested by

no test coverage detected