Skip to content

Commit

Permalink
Distinguish overlap w/ compactino from w/ db
Browse files Browse the repository at this point in the history
Signed-off-by: Yang Zhang <[email protected]>
  • Loading branch information
v01dstar committed Oct 23, 2024
1 parent 43ee15f commit a9ecdce
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions db/external_sst_file_ingestion_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -911,18 +911,6 @@ Status ExternalSstFileIngestionJob::AssignLevelAndSeqnoForIngestedFile(
if (lvl > 0 && lvl < vstorage->base_level()) {
continue;
}
// if (cfd_->RangeOverlapWithCompaction(
// file_to_ingest->smallest_internal_key.user_key(),
// file_to_ingest->largest_internal_key.user_key(), lvl)) {
// // We must use L0 or any level higher than `lvl` to be able to
// overwrite
// // the compaction output keys that we overlap with in this level, We
// also
// // need to assign this file a seqno to overwrite the compaction output
// // keys in level `lvl`
// overlap_with_db = true;
// break;
// } else if (vstorage->NumLevelFiles(lvl) > 0) {
if (vstorage->NumLevelFiles(lvl) > 0) {
bool overlap_with_level = false;
status = sv->current->OverlapWithLevelIterator(
Expand Down Expand Up @@ -1125,6 +1113,13 @@ bool ExternalSstFileIngestionJob::IngestedFileFitInLevel(
return false;
}

if (cfd_->RangeOverlapWithCompaction(file_smallest_user_key,
file_largest_user_key, level)) {
// File overlap with a running compaction output that will be stored
// in this level, we cannot add this file to this level
return false;
}

// File did not overlap with level files, nor compaction output
return true;
}
Expand Down

0 comments on commit a9ecdce

Please sign in to comment.