Remove early return when scanning files for temperature change compaction (#13112)

Summary:
This is a small follow-up to https://github.com/facebook/rocksdb/pull/13083.

When we check the `newest_key_time` of files for temperature change compaction, we currently return early if we ever find a file with an unknown `est_newest_key_time`.

However, it is possible for a younger file to have a populated value for `newest_key_time`, since this is a new table property.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/13112

Test Plan: The existing unit tests are sufficient.

Reviewed By: cbi42

Differential Revision: D65451797

Pulled By: archang19

fbshipit-source-id: 28e67c2d35a6315f912471f2848de87dd7088d99
This commit is contained in:
Andrew Chang 2024-11-05 09:12:39 -08:00 committed by Facebook GitHub Bot
parent 3becc9409e
commit a7ecbfd590
2 changed files with 10 additions and 4 deletions

View File

@ -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;

View File

@ -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;