| 1529 | } |
| 1530 | |
| 1531 | bool 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 | |
| 1555 | void Compaction::ReleaseInputs() { |
| 1556 | if (input_version_ != nullptr) { |
no test coverage detected