diff --git a/db/compaction/compaction_picker_fifo.cc b/db/compaction/compaction_picker_fifo.cc index 5a3a958e97..d5c7351940 100644 --- a/db/compaction/compaction_picker_fifo.cc +++ b/db/compaction/compaction_picker_fifo.cc @@ -370,8 +370,11 @@ Compaction* FIFOCompactionPicker::PickTemperatureChangeCompaction( return nullptr; } uint64_t est_newest_key_time = cur_file->TryGetNewestKeyTime(prev_file); - if (est_newest_key_time == kUnknownNewestKeyTime || - est_newest_key_time > create_time_threshold) { + // Newer file could have newest_key_time populated + if (est_newest_key_time == kUnknownNewestKeyTime) { + continue; + } + if (est_newest_key_time > create_time_threshold) { break; } Temperature cur_target_temp = ages[0].temperature; diff --git a/db/version_set.cc b/db/version_set.cc index aa2a49a1b7..d06eb71202 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -3397,8 +3397,11 @@ bool ShouldChangeFileTemperature(const ImmutableOptions& ioptions, FileMetaData* prev_file = index < 2 ? nullptr : files[index - 2]; if (!cur_file->being_compacted) { uint64_t est_newest_key_time = cur_file->TryGetNewestKeyTime(prev_file); - if (est_newest_key_time == kUnknownNewestKeyTime || - est_newest_key_time > create_time_threshold) { + // Newer file could have newest_key_time populated + if (est_newest_key_time == kUnknownNewestKeyTime) { + continue; + } + if (est_newest_key_time > create_time_threshold) { return false; } target_temp = ages[0].temperature;