Created
October 30, 2021 00:01
-
-
Save siying/c6322f6d9cd1b2febc6c9408f8b8c877 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/db/compaction/compaction_job.cc b/db/compaction/compaction_job.cc | |
index 7ca428607..bc456e5fd 100644 | |
--- a/db/compaction/compaction_job.cc | |
+++ b/db/compaction/compaction_job.cc | |
@@ -321,20 +321,15 @@ void CompactionJob::SubcompactionState::FillFilesToCutForTtl() { | |
if (current_time < compaction->mutable_cf_options()->ttl) { | |
return; | |
} | |
- uint64_t old_age_thres = | |
- current_time - compaction->mutable_cf_options()->ttl / 2; | |
const std::vector<FileMetaData*>& olevel = | |
*(compaction->inputs(compaction->num_input_levels() - 1)); | |
+ uint64_t ac_size = 0; | |
for (FileMetaData* file : olevel) { | |
- // Worth filtering out by start and end? | |
- uint64_t oldest_ancester_time = file->TryGetOldestAncesterTime(); | |
- // We put old files if they are not too small to prevent a flood | |
- // of small files. | |
- if (oldest_ancester_time < old_age_thres && | |
- file->fd.GetFileSize() > | |
- compaction->mutable_cf_options()->target_file_size_base / 2) { | |
+ ac_size += file->fd.GetFileSize(); | |
+ if (ac_size > compaction->mutable_cf_options()->target_file_size_base) { | |
files_to_cut_for_ttl.push_back(file); | |
+ ac_size = 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment