Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce potential reading when ingest external sst file #3160

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion db/external_sst_file_ingestion_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,16 @@ Status ExternalSstFileIngestionJob::AssignLevelAndSeqnoForIngestedFile(
continue;
}

// If compaction type is not universal, check overlap directly. No need to
// open files and Seeking kv pairs or reading delete range marks.
if (compaction_style != kCompactionStyleUniversal) {
if (IngestedFileFitInLevel(file_to_ingest, lvl)) {
target_level = lvl;
continue;
}
break;
}

if (vstorage->NumLevelFiles(lvl) > 0) {
bool overlap_with_level = false;
status = IngestedFileOverlapWithLevel(sv, file_to_ingest, lvl,
Expand Down Expand Up @@ -476,7 +486,8 @@ Status ExternalSstFileIngestionJob::AssignLevelAndSeqnoForIngestedFile(

// We dont overlap with any keys in this level, but we still need to check
// if our file can fit in it
if (IngestedFileFitInLevel(file_to_ingest, lvl)) {
if (compaction_style == kCompactionStyleUniversal &&
IngestedFileFitInLevel(file_to_ingest, lvl)) {
target_level = lvl;
}
}
Expand Down