From 88875df821297e0ea5b248afd85d166456318504 Mon Sep 17 00:00:00 2001 From: sdong Date: Fri, 3 Dec 2021 14:42:05 -0800 Subject: [PATCH] File temperature information should be preserved when restart the DB (#9242) Summary: Fix a bug that causes file temperature not preserved after DB is restarted, or options.max_manifest_file_size is hit. Also, pass temperature information to NewRandomAccessFile() to allow users to hack a solution where they don't preserve tiering information. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9242 Test Plan: Add a unit test that would fail without the fix. Reviewed By: jay-zhuang Differential Revision: D32818150 fbshipit-source-id: 36aa3f148c60107f7b8e9d65b63b039f9e1a1eec --- db/compaction/compaction_job_test.cc | 9 +- db/compaction/compaction_picker_test.cc | 3 +- db/db_impl/db_impl_compaction_flush.cc | 4 +- db/db_impl/db_impl_experimental.cc | 14 +- db/db_impl/db_impl_open.cc | 14 +- db/db_test2.cc | 6 + db/external_sst_file_ingestion_job.cc | 7 +- db/flush_job.cc | 9 +- db/import_column_family_job.cc | 8 +- db/repair.cc | 2 +- db/table_cache.cc | 2 + db/version_builder_test.cc | 207 ++++++++++++------------ db/version_edit.h | 14 +- db/version_edit_test.cc | 40 ++--- db/version_set.cc | 14 +- db/version_set_test.cc | 41 ++--- tools/simulated_hybrid_file_system.cc | 1 + 17 files changed, 213 insertions(+), 182 deletions(-) diff --git a/db/compaction/compaction_job_test.cc b/db/compaction/compaction_job_test.cc index 17dd35886..bd688ca3f 100644 --- a/db/compaction/compaction_job_test.cc +++ b/db/compaction/compaction_job_test.cc @@ -203,10 +203,11 @@ class CompactionJobTestBase : public testing::Test { VersionEdit edit; edit.AddFile(level, file_number, 0, 10, smallest_key, largest_key, - smallest_seqno, largest_seqno, false, oldest_blob_file_number, - kUnknownOldestAncesterTime, kUnknownFileCreationTime, - kUnknownFileChecksum, kUnknownFileChecksumFuncName, - kDisableUserTimestamp, kDisableUserTimestamp); + smallest_seqno, largest_seqno, false, Temperature::kUnknown, + oldest_blob_file_number, kUnknownOldestAncesterTime, + kUnknownFileCreationTime, kUnknownFileChecksum, + kUnknownFileChecksumFuncName, kDisableUserTimestamp, + kDisableUserTimestamp); mutex_.Lock(); EXPECT_OK( diff --git a/db/compaction/compaction_picker_test.cc b/db/compaction/compaction_picker_test.cc index 07b2c404f..6b005db0b 100644 --- a/db/compaction/compaction_picker_test.cc +++ b/db/compaction/compaction_picker_test.cc @@ -112,13 +112,12 @@ class CompactionPickerTest : public testing::Test { file_number, path_id, file_size, InternalKey(smallest, smallest_seq, kTypeValue), InternalKey(largest, largest_seq, kTypeValue), smallest_seq, - largest_seq, marked_for_compact, kInvalidBlobFileNumber, + largest_seq, marked_for_compact, temperature, kInvalidBlobFileNumber, kUnknownOldestAncesterTime, kUnknownFileCreationTime, kUnknownFileChecksum, kUnknownFileChecksumFuncName, kDisableUserTimestamp, kDisableUserTimestamp); f->compensated_file_size = (compensated_file_size != 0) ? compensated_file_size : file_size; - f->temperature = temperature; f->oldest_ancester_time = oldest_ancestor_time; vstorage->AddFile(level, f); files_.emplace_back(f); diff --git a/db/db_impl/db_impl_compaction_flush.cc b/db/db_impl/db_impl_compaction_flush.cc index b1ffe632f..80410f671 100644 --- a/db/db_impl/db_impl_compaction_flush.cc +++ b/db/db_impl/db_impl_compaction_flush.cc @@ -1611,7 +1611,7 @@ Status DBImpl::ReFitLevel(ColumnFamilyData* cfd, int level, int target_level) { edit.AddFile( to_level, f->fd.GetNumber(), f->fd.GetPathId(), f->fd.GetFileSize(), f->smallest, f->largest, f->fd.smallest_seqno, f->fd.largest_seqno, - f->marked_for_compaction, f->oldest_blob_file_number, + f->marked_for_compaction, f->temperature, f->oldest_blob_file_number, f->oldest_ancester_time, f->file_creation_time, f->file_checksum, f->file_checksum_func_name, f->min_timestamp, f->max_timestamp); } @@ -3196,7 +3196,7 @@ Status DBImpl::BackgroundCompaction(bool* made_progress, c->edit()->AddFile( c->output_level(), f->fd.GetNumber(), f->fd.GetPathId(), f->fd.GetFileSize(), f->smallest, f->largest, f->fd.smallest_seqno, - f->fd.largest_seqno, f->marked_for_compaction, + f->fd.largest_seqno, f->marked_for_compaction, f->temperature, f->oldest_blob_file_number, f->oldest_ancester_time, f->file_creation_time, f->file_checksum, f->file_checksum_func_name, f->min_timestamp, f->max_timestamp); diff --git a/db/db_impl/db_impl_experimental.cc b/db/db_impl/db_impl_experimental.cc index da38cd234..9436d7474 100644 --- a/db/db_impl/db_impl_experimental.cc +++ b/db/db_impl/db_impl_experimental.cc @@ -126,13 +126,13 @@ Status DBImpl::PromoteL0(ColumnFamilyHandle* column_family, int target_level) { edit.SetColumnFamily(cfd->GetID()); for (const auto& f : l0_files) { edit.DeleteFile(0, f->fd.GetNumber()); - edit.AddFile(target_level, f->fd.GetNumber(), f->fd.GetPathId(), - f->fd.GetFileSize(), f->smallest, f->largest, - f->fd.smallest_seqno, f->fd.largest_seqno, - f->marked_for_compaction, f->oldest_blob_file_number, - f->oldest_ancester_time, f->file_creation_time, - f->file_checksum, f->file_checksum_func_name, - f->min_timestamp, f->max_timestamp); + edit.AddFile( + target_level, f->fd.GetNumber(), f->fd.GetPathId(), + f->fd.GetFileSize(), f->smallest, f->largest, f->fd.smallest_seqno, + f->fd.largest_seqno, f->marked_for_compaction, f->temperature, + f->oldest_blob_file_number, f->oldest_ancester_time, + f->file_creation_time, f->file_checksum, f->file_checksum_func_name, + f->min_timestamp, f->max_timestamp); } status = versions_->LogAndApply(cfd, *cfd->GetLatestMutableCFOptions(), diff --git a/db/db_impl/db_impl_open.cc b/db/db_impl/db_impl_open.cc index f3c9dc9e3..f73060a9e 100644 --- a/db/db_impl/db_impl_open.cc +++ b/db/db_impl/db_impl_open.cc @@ -1465,13 +1465,13 @@ Status DBImpl::WriteLevel0TableForRecovery(int job_id, ColumnFamilyData* cfd, constexpr int level = 0; if (s.ok() && has_output) { - edit->AddFile(level, meta.fd.GetNumber(), meta.fd.GetPathId(), - meta.fd.GetFileSize(), meta.smallest, meta.largest, - meta.fd.smallest_seqno, meta.fd.largest_seqno, - meta.marked_for_compaction, meta.oldest_blob_file_number, - meta.oldest_ancester_time, meta.file_creation_time, - meta.file_checksum, meta.file_checksum_func_name, - meta.min_timestamp, meta.max_timestamp); + edit->AddFile( + level, meta.fd.GetNumber(), meta.fd.GetPathId(), meta.fd.GetFileSize(), + meta.smallest, meta.largest, meta.fd.smallest_seqno, + meta.fd.largest_seqno, meta.marked_for_compaction, meta.temperature, + meta.oldest_blob_file_number, meta.oldest_ancester_time, + meta.file_creation_time, meta.file_checksum, + meta.file_checksum_func_name, meta.min_timestamp, meta.max_timestamp); for (const auto& blob : blob_file_additions) { edit->AddBlobFile(blob); diff --git a/db/db_test2.cc b/db/db_test2.cc index 91a174ad6..e09d05d45 100644 --- a/db/db_test2.cc +++ b/db/db_test2.cc @@ -6601,6 +6601,12 @@ TEST_F(DBTest2, BottommostTemperature) { DB::Properties::kLiveSstFilesSizeAtTemperature + std::to_string(22), &prop)); ASSERT_EQ(std::atoi(prop.c_str()), 0); + + Reopen(options); + db_->GetColumnFamilyMetaData(&metadata); + ASSERT_EQ(2, metadata.file_count); + ASSERT_EQ(Temperature::kUnknown, metadata.levels[0].files[0].temperature); + ASSERT_EQ(Temperature::kWarm, metadata.levels[1].files[0].temperature); } TEST_F(DBTest2, BottommostTemperatureUniversal) { diff --git a/db/external_sst_file_ingestion_job.cc b/db/external_sst_file_ingestion_job.cc index 6384eff94..84d84d781 100644 --- a/db/external_sst_file_ingestion_job.cc +++ b/db/external_sst_file_ingestion_job.cc @@ -440,9 +440,10 @@ Status ExternalSstFileIngestionJob::Run() { FileMetaData f_metadata( f.fd.GetNumber(), f.fd.GetPathId(), f.fd.GetFileSize(), f.smallest_internal_key, f.largest_internal_key, f.assigned_seqno, - f.assigned_seqno, false, kInvalidBlobFileNumber, oldest_ancester_time, - current_time, f.file_checksum, f.file_checksum_func_name, - kDisableUserTimestamp, kDisableUserTimestamp); + f.assigned_seqno, false, f.file_temperature, kInvalidBlobFileNumber, + oldest_ancester_time, current_time, f.file_checksum, + f.file_checksum_func_name, kDisableUserTimestamp, + kDisableUserTimestamp); f_metadata.temperature = f.file_temperature; edit_.AddFile(f.picked_level, f_metadata); } diff --git a/db/flush_job.cc b/db/flush_job.cc index 65716b689..f2046abec 100644 --- a/db/flush_job.cc +++ b/db/flush_job.cc @@ -960,10 +960,11 @@ Status FlushJob::WriteLevel0Table() { edit_->AddFile(0 /* level */, meta_.fd.GetNumber(), meta_.fd.GetPathId(), meta_.fd.GetFileSize(), meta_.smallest, meta_.largest, meta_.fd.smallest_seqno, meta_.fd.largest_seqno, - meta_.marked_for_compaction, meta_.oldest_blob_file_number, - meta_.oldest_ancester_time, meta_.file_creation_time, - meta_.file_checksum, meta_.file_checksum_func_name, - meta_.min_timestamp, meta_.max_timestamp); + meta_.marked_for_compaction, meta_.temperature, + meta_.oldest_blob_file_number, meta_.oldest_ancester_time, + meta_.file_creation_time, meta_.file_checksum, + meta_.file_checksum_func_name, meta_.min_timestamp, + meta_.max_timestamp); edit_->SetBlobFileAdditions(std::move(blob_file_additions)); } diff --git a/db/import_column_family_job.cc b/db/import_column_family_job.cc index b9390565a..9dc226238 100644 --- a/db/import_column_family_job.cc +++ b/db/import_column_family_job.cc @@ -153,10 +153,10 @@ Status ImportColumnFamilyJob::Run() { edit_.AddFile(file_metadata.level, f.fd.GetNumber(), f.fd.GetPathId(), f.fd.GetFileSize(), f.smallest_internal_key, f.largest_internal_key, file_metadata.smallest_seqno, - file_metadata.largest_seqno, false, kInvalidBlobFileNumber, - oldest_ancester_time, current_time, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + file_metadata.largest_seqno, false, file_metadata.temperature, + kInvalidBlobFileNumber, oldest_ancester_time, current_time, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); // If incoming sequence number is higher, update local sequence number. if (file_metadata.largest_seqno > versions_->LastSequence()) { diff --git a/db/repair.cc b/db/repair.cc index 720b0296b..acec61bad 100644 --- a/db/repair.cc +++ b/db/repair.cc @@ -633,7 +633,7 @@ class Repairer { table->meta.fd.GetFileSize(), table->meta.smallest, table->meta.largest, table->meta.fd.smallest_seqno, table->meta.fd.largest_seqno, table->meta.marked_for_compaction, - table->meta.oldest_blob_file_number, + table->meta.temperature, table->meta.oldest_blob_file_number, table->meta.oldest_ancester_time, table->meta.file_creation_time, table->meta.file_checksum, table->meta.file_checksum_func_name, table->meta.min_timestamp, table->meta.max_timestamp); diff --git a/db/table_cache.cc b/db/table_cache.cc index 8bcd81c52..aea78769a 100644 --- a/db/table_cache.cc +++ b/db/table_cache.cc @@ -17,6 +17,7 @@ #include "file/filename.h" #include "file/random_access_file_reader.h" #include "monitoring/perf_context_imp.h" +#include "rocksdb/advanced_options.h" #include "rocksdb/statistics.h" #include "table/block_based/block_based_table_reader.h" #include "table/get_context.h" @@ -108,6 +109,7 @@ Status TableCache::GetTableReader( TableFileName(ioptions_.cf_paths, fd.GetNumber(), fd.GetPathId()); std::unique_ptr file; FileOptions fopts = file_options; + fopts.temperature = file_temperature; Status s = PrepareIOFromReadOptions(ro, ioptions_.clock, fopts.io_options); if (s.ok()) { s = ioptions_.fs->NewRandomAccessFile(fname, fopts, &file, nullptr); diff --git a/db/version_builder_test.cc b/db/version_builder_test.cc index 4ef3612d8..0af81d986 100644 --- a/db/version_builder_test.cc +++ b/db/version_builder_test.cc @@ -11,6 +11,7 @@ #include "db/version_edit.h" #include "db/version_set.h" +#include "rocksdb/advanced_options.h" #include "test_util/testharness.h" #include "test_util/testutil.h" #include "util/string_util.h" @@ -67,10 +68,11 @@ class VersionBuilderTest : public testing::Test { FileMetaData* f = new FileMetaData( file_number, path_id, file_size, GetInternalKey(smallest, smallest_seq), GetInternalKey(largest, largest_seq), smallest_seqno, largest_seqno, - /* marked_for_compact */ false, oldest_blob_file_number, - kUnknownOldestAncesterTime, kUnknownFileCreationTime, - kUnknownFileChecksum, kUnknownFileChecksumFuncName, - kDisableUserTimestamp, kDisableUserTimestamp); + /* marked_for_compact */ false, Temperature::kUnknown, + oldest_blob_file_number, kUnknownOldestAncesterTime, + kUnknownFileCreationTime, kUnknownFileChecksum, + kUnknownFileChecksumFuncName, kDisableUserTimestamp, + kDisableUserTimestamp); f->compensated_file_size = file_size; f->num_entries = num_entries; f->num_deletions = num_deletions; @@ -129,10 +131,10 @@ class VersionBuilderTest : public testing::Test { edit->AddFile(level, table_file_number, path_id, file_size, GetInternalKey(smallest), GetInternalKey(largest), smallest_seqno, largest_seqno, marked_for_compaction, - blob_file_number, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, blob_file_number, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); } static std::shared_ptr GetBlobFileMetaData( @@ -190,10 +192,10 @@ TEST_F(VersionBuilderTest, ApplyAndSaveTo) { VersionEdit version_edit; version_edit.AddFile(2, 666, 0, 100U, GetInternalKey("301"), GetInternalKey("350"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); version_edit.DeleteFile(3, 27U); EnvOptions env_options; @@ -231,10 +233,10 @@ TEST_F(VersionBuilderTest, ApplyAndSaveToDynamic) { VersionEdit version_edit; version_edit.AddFile(3, 666, 0, 100U, GetInternalKey("301"), GetInternalKey("350"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); version_edit.DeleteFile(0, 1U); version_edit.DeleteFile(0, 88U); @@ -275,10 +277,10 @@ TEST_F(VersionBuilderTest, ApplyAndSaveToDynamic2) { VersionEdit version_edit; version_edit.AddFile(4, 666, 0, 100U, GetInternalKey("301"), GetInternalKey("350"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); version_edit.DeleteFile(0, 1U); version_edit.DeleteFile(0, 88U); version_edit.DeleteFile(4, 6U); @@ -310,34 +312,34 @@ TEST_F(VersionBuilderTest, ApplyMultipleAndSaveTo) { VersionEdit version_edit; version_edit.AddFile(2, 666, 0, 100U, GetInternalKey("301"), GetInternalKey("350"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); version_edit.AddFile(2, 676, 0, 100U, GetInternalKey("401"), GetInternalKey("450"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); version_edit.AddFile(2, 636, 0, 100U, GetInternalKey("601"), GetInternalKey("650"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); version_edit.AddFile(2, 616, 0, 100U, GetInternalKey("501"), GetInternalKey("550"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); version_edit.AddFile(2, 606, 0, 100U, GetInternalKey("701"), GetInternalKey("750"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); EnvOptions env_options; constexpr TableCache* table_cache = nullptr; @@ -372,51 +374,51 @@ TEST_F(VersionBuilderTest, ApplyDeleteAndSaveTo) { VersionEdit version_edit; version_edit.AddFile(2, 666, 0, 100U, GetInternalKey("301"), GetInternalKey("350"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); version_edit.AddFile(2, 676, 0, 100U, GetInternalKey("401"), GetInternalKey("450"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); version_edit.AddFile(2, 636, 0, 100U, GetInternalKey("601"), GetInternalKey("650"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); version_edit.AddFile(2, 616, 0, 100U, GetInternalKey("501"), GetInternalKey("550"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); version_edit.AddFile(2, 606, 0, 100U, GetInternalKey("701"), GetInternalKey("750"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); ASSERT_OK(version_builder.Apply(&version_edit)); VersionEdit version_edit2; version_edit.AddFile(2, 808, 0, 100U, GetInternalKey("901"), GetInternalKey("950"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); version_edit2.DeleteFile(2, 616); version_edit2.DeleteFile(2, 636); version_edit.AddFile(2, 806, 0, 100U, GetInternalKey("801"), GetInternalKey("850"), 200, 200, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); ASSERT_OK(version_builder.Apply(&version_edit2)); ASSERT_OK(version_builder.SaveTo(&new_vstorage)); @@ -515,10 +517,11 @@ TEST_F(VersionBuilderTest, ApplyFileDeletionAndAddition) { addition.AddFile(level, file_number, path_id, file_size, GetInternalKey(smallest, smallest_seq), GetInternalKey(largest, largest_seq), smallest_seqno, - largest_seqno, marked_for_compaction, kInvalidBlobFileNumber, - kUnknownOldestAncesterTime, kUnknownFileCreationTime, - kUnknownFileChecksum, kUnknownFileChecksumFuncName, - kDisableUserTimestamp, kDisableUserTimestamp); + largest_seqno, marked_for_compaction, Temperature::kUnknown, + kInvalidBlobFileNumber, kUnknownOldestAncesterTime, + kUnknownFileCreationTime, kUnknownFileChecksum, + kUnknownFileChecksumFuncName, kDisableUserTimestamp, + kDisableUserTimestamp); ASSERT_OK(builder.Apply(&addition)); @@ -560,10 +563,10 @@ TEST_F(VersionBuilderTest, ApplyFileAdditionAlreadyInBase) { edit.AddFile(new_level, file_number, path_id, file_size, GetInternalKey(smallest), GetInternalKey(largest), smallest_seqno, largest_seqno, marked_for_compaction, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); const Status s = builder.Apply(&edit); ASSERT_TRUE(s.IsCorruption()); @@ -594,10 +597,11 @@ TEST_F(VersionBuilderTest, ApplyFileAdditionAlreadyApplied) { edit.AddFile(level, file_number, path_id, file_size, GetInternalKey(smallest), GetInternalKey(largest), smallest_seqno, largest_seqno, - marked_for_compaction, kInvalidBlobFileNumber, - kUnknownOldestAncesterTime, kUnknownFileCreationTime, - kUnknownFileChecksum, kUnknownFileChecksumFuncName, - kDisableUserTimestamp, kDisableUserTimestamp); + marked_for_compaction, Temperature::kUnknown, + kInvalidBlobFileNumber, kUnknownOldestAncesterTime, + kUnknownFileCreationTime, kUnknownFileChecksum, + kUnknownFileChecksumFuncName, kDisableUserTimestamp, + kDisableUserTimestamp); ASSERT_OK(builder.Apply(&edit)); @@ -608,10 +612,10 @@ TEST_F(VersionBuilderTest, ApplyFileAdditionAlreadyApplied) { other_edit.AddFile(new_level, file_number, path_id, file_size, GetInternalKey(smallest), GetInternalKey(largest), smallest_seqno, largest_seqno, marked_for_compaction, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); const Status s = builder.Apply(&other_edit); ASSERT_TRUE(s.IsCorruption()); @@ -643,10 +647,10 @@ TEST_F(VersionBuilderTest, ApplyFileAdditionAndDeletion) { addition.AddFile(level, file_number, path_id, file_size, GetInternalKey(smallest), GetInternalKey(largest), smallest_seqno, largest_seqno, marked_for_compaction, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); ASSERT_OK(builder.Apply(&addition)); @@ -1172,12 +1176,12 @@ TEST_F(VersionBuilderTest, SaveBlobFilesToConcurrentJobs) { constexpr uint64_t total_blob_count = 234; constexpr uint64_t total_blob_bytes = 1 << 22; - edit.AddFile(level, table_file_number, path_id, file_size, - GetInternalKey(smallest), GetInternalKey(largest), - smallest_seqno, largest_seqno, marked_for_compaction, - blob_file_number, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, checksum_value, checksum_method, - kDisableUserTimestamp, kDisableUserTimestamp); + edit.AddFile( + level, table_file_number, path_id, file_size, GetInternalKey(smallest), + GetInternalKey(largest), smallest_seqno, largest_seqno, + marked_for_compaction, Temperature::kUnknown, blob_file_number, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, checksum_value, + checksum_method, kDisableUserTimestamp, kDisableUserTimestamp); edit.AddBlobFile(blob_file_number, total_blob_count, total_blob_bytes, checksum_method, checksum_value); @@ -1259,6 +1263,7 @@ TEST_F(VersionBuilderTest, CheckConsistencyForBlobFiles) { /* file_size */ 100, /* smallest */ GetInternalKey("701"), /* largest */ GetInternalKey("750"), /* smallest_seqno */ 200, /* largest_seqno */ 200, /* marked_for_compaction */ false, + Temperature::kUnknown, /* oldest_blob_file_number */ 16, kUnknownOldestAncesterTime, kUnknownFileCreationTime, kUnknownFileChecksum, kUnknownFileChecksumFuncName, kDisableUserTimestamp, @@ -1268,6 +1273,7 @@ TEST_F(VersionBuilderTest, CheckConsistencyForBlobFiles) { /* file_size */ 100, /* smallest */ GetInternalKey("801"), /* largest */ GetInternalKey("850"), /* smallest_seqno */ 200, /* largest_seqno */ 200, /* marked_for_compaction */ false, + Temperature::kUnknown, /* oldest_blob_file_number */ 1000, kUnknownOldestAncesterTime, kUnknownFileCreationTime, kUnknownFileChecksum, kUnknownFileChecksumFuncName, kDisableUserTimestamp, @@ -1487,6 +1493,7 @@ TEST_F(VersionBuilderTest, MaintainLinkedSstsForBlobFiles) { /* file_size */ 100, /* smallest */ GetInternalKey("21", 2100), /* largest */ GetInternalKey("21", 2100), /* smallest_seqno */ 2100, /* largest_seqno */ 2100, /* marked_for_compaction */ false, + Temperature::kUnknown, /* oldest_blob_file_number */ 1, kUnknownOldestAncesterTime, kUnknownFileCreationTime, kUnknownFileChecksum, kUnknownFileChecksumFuncName, kDisableUserTimestamp, @@ -1498,7 +1505,7 @@ TEST_F(VersionBuilderTest, MaintainLinkedSstsForBlobFiles) { /* file_size */ 100, /* smallest */ GetInternalKey("22", 2200), /* largest */ GetInternalKey("22", 2200), /* smallest_seqno */ 2200, /* largest_seqno */ 2200, /* marked_for_compaction */ false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, + Temperature::kUnknown, kInvalidBlobFileNumber, kUnknownOldestAncesterTime, kUnknownFileCreationTime, kUnknownFileChecksum, kUnknownFileChecksumFuncName, kDisableUserTimestamp, kDisableUserTimestamp); @@ -1521,6 +1528,7 @@ TEST_F(VersionBuilderTest, MaintainLinkedSstsForBlobFiles) { /* largest */ GetInternalKey("03", 300), /* smallest_seqno */ 300, /* largest_seqno */ 300, /* marked_for_compaction */ false, + Temperature::kUnknown, /* oldest_blob_file_number */ 3, kUnknownOldestAncesterTime, kUnknownFileCreationTime, kUnknownFileChecksum, kUnknownFileChecksumFuncName, kDisableUserTimestamp, @@ -1533,10 +1541,10 @@ TEST_F(VersionBuilderTest, MaintainLinkedSstsForBlobFiles) { /* largest */ GetInternalKey("13", 1300), /* smallest_seqno */ 1300, /* largest_seqno */ 1300, /* marked_for_compaction */ false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); // Add one more SST file that references a blob file, then promptly // delete it in a second version edit before the new version gets saved. @@ -1546,6 +1554,7 @@ TEST_F(VersionBuilderTest, MaintainLinkedSstsForBlobFiles) { /* largest */ GetInternalKey("23", 2300), /* smallest_seqno */ 2300, /* largest_seqno */ 2300, /* marked_for_compaction */ false, + Temperature::kUnknown, /* oldest_blob_file_number */ 5, kUnknownOldestAncesterTime, kUnknownFileCreationTime, kUnknownFileChecksum, kUnknownFileChecksumFuncName, kDisableUserTimestamp, diff --git a/db/version_edit.h b/db/version_edit.h index 772ca24c6..8dacf939c 100644 --- a/db/version_edit.h +++ b/db/version_edit.h @@ -19,6 +19,7 @@ #include "db/dbformat.h" #include "db/wal_edit.h" #include "memory/arena.h" +#include "rocksdb/advanced_options.h" #include "rocksdb/cache.h" #include "table/table_reader.h" #include "util/autovector.h" @@ -222,14 +223,16 @@ struct FileMetaData { const InternalKey& smallest_key, const InternalKey& largest_key, const SequenceNumber& smallest_seq, const SequenceNumber& largest_seq, bool marked_for_compact, - uint64_t oldest_blob_file, uint64_t _oldest_ancester_time, - uint64_t _file_creation_time, const std::string& _file_checksum, + Temperature _temperature, uint64_t oldest_blob_file, + uint64_t _oldest_ancester_time, uint64_t _file_creation_time, + const std::string& _file_checksum, const std::string& _file_checksum_func_name, std::string _min_timestamp, std::string _max_timestamp) : fd(file, file_path_id, file_size, smallest_seq, largest_seq), smallest(smallest_key), largest(largest_key), marked_for_compaction(marked_for_compact), + temperature(_temperature), oldest_blob_file_number(oldest_blob_file), oldest_ancester_time(_oldest_ancester_time), file_creation_time(_file_creation_time), @@ -401,8 +404,9 @@ class VersionEdit { uint64_t file_size, const InternalKey& smallest, const InternalKey& largest, const SequenceNumber& smallest_seqno, const SequenceNumber& largest_seqno, bool marked_for_compaction, - uint64_t oldest_blob_file_number, uint64_t oldest_ancester_time, - uint64_t file_creation_time, const std::string& file_checksum, + Temperature temperature, uint64_t oldest_blob_file_number, + uint64_t oldest_ancester_time, uint64_t file_creation_time, + const std::string& file_checksum, const std::string& file_checksum_func_name, const std::string& min_timestamp, const std::string& max_timestamp) { @@ -411,7 +415,7 @@ class VersionEdit { level, FileMetaData(file, file_path_id, file_size, smallest, largest, smallest_seqno, largest_seqno, marked_for_compaction, - oldest_blob_file_number, oldest_ancester_time, + temperature, oldest_blob_file_number, oldest_ancester_time, file_creation_time, file_checksum, file_checksum_func_name, min_timestamp, max_timestamp)); } diff --git a/db/version_edit_test.cc b/db/version_edit_test.cc index 7668599df..c9e918c4e 100644 --- a/db/version_edit_test.cc +++ b/db/version_edit_test.cc @@ -9,6 +9,7 @@ #include "db/version_edit.h" +#include "rocksdb/advanced_options.h" #include "test_util/sync_point.h" #include "test_util/testharness.h" #include "test_util/testutil.h" @@ -39,8 +40,9 @@ TEST_F(VersionEditTest, EncodeDecode) { edit.AddFile(3, kBig + 300 + i, kBig32Bit + 400 + i, 0, InternalKey("foo", kBig + 500 + i, kTypeValue), InternalKey("zoo", kBig + 600 + i, kTypeDeletion), - kBig + 500 + i, kBig + 600 + i, false, kInvalidBlobFileNumber, - 888, 678, "234", "crc32c", "123", "345"); + kBig + 500 + i, kBig + 600 + i, false, Temperature::kUnknown, + kInvalidBlobFileNumber, 888, 678, "234", "crc32c", "123", + "345"); edit.DeleteFile(4, kBig + 700 + i); } @@ -57,26 +59,27 @@ TEST_F(VersionEditTest, EncodeDecodeNewFile4) { VersionEdit edit; edit.AddFile(3, 300, 3, 100, InternalKey("foo", kBig + 500, kTypeValue), InternalKey("zoo", kBig + 600, kTypeDeletion), kBig + 500, - kBig + 600, true, kInvalidBlobFileNumber, + kBig + 600, true, Temperature::kUnknown, kInvalidBlobFileNumber, kUnknownOldestAncesterTime, kUnknownFileCreationTime, kUnknownFileChecksum, kUnknownFileChecksumFuncName, "123", "234"); edit.AddFile(4, 301, 3, 100, InternalKey("foo", kBig + 501, kTypeValue), InternalKey("zoo", kBig + 601, kTypeDeletion), kBig + 501, - kBig + 601, false, kInvalidBlobFileNumber, + kBig + 601, false, Temperature::kUnknown, kInvalidBlobFileNumber, kUnknownOldestAncesterTime, kUnknownFileCreationTime, kUnknownFileChecksum, kUnknownFileChecksumFuncName, "345", "543"); edit.AddFile(5, 302, 0, 100, InternalKey("foo", kBig + 502, kTypeValue), InternalKey("zoo", kBig + 602, kTypeDeletion), kBig + 502, - kBig + 602, true, kInvalidBlobFileNumber, 666, 888, - kUnknownFileChecksum, kUnknownFileChecksumFuncName, "456", - "567"); + kBig + 602, true, Temperature::kUnknown, kInvalidBlobFileNumber, + 666, 888, kUnknownFileChecksum, kUnknownFileChecksumFuncName, + "456", "567"); edit.AddFile(5, 303, 0, 100, InternalKey("foo", kBig + 503, kTypeBlobIndex), InternalKey("zoo", kBig + 603, kTypeBlobIndex), kBig + 503, - kBig + 603, true, 1001, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, "678", "789"); + kBig + 603, true, Temperature::kUnknown, 1001, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, "678", + "789"); ; edit.DeleteFile(4, 700); @@ -123,14 +126,15 @@ TEST_F(VersionEditTest, ForwardCompatibleNewFile4) { VersionEdit edit; edit.AddFile(3, 300, 3, 100, InternalKey("foo", kBig + 500, kTypeValue), InternalKey("zoo", kBig + 600, kTypeDeletion), kBig + 500, - kBig + 600, true, kInvalidBlobFileNumber, + kBig + 600, true, Temperature::kUnknown, kInvalidBlobFileNumber, kUnknownOldestAncesterTime, kUnknownFileCreationTime, kUnknownFileChecksum, kUnknownFileChecksumFuncName, "123", "234"); edit.AddFile(4, 301, 3, 100, InternalKey("foo", kBig + 501, kTypeValue), InternalKey("zoo", kBig + 601, kTypeDeletion), kBig + 501, - kBig + 601, false, kInvalidBlobFileNumber, 686, 868, "234", - "crc32c", kDisableUserTimestamp, kDisableUserTimestamp); + kBig + 601, false, Temperature::kUnknown, kInvalidBlobFileNumber, + 686, 868, "234", "crc32c", kDisableUserTimestamp, + kDisableUserTimestamp); edit.DeleteFile(4, 700); edit.SetComparatorName("foo"); @@ -180,7 +184,7 @@ TEST_F(VersionEditTest, NewFile4NotSupportedField) { VersionEdit edit; edit.AddFile(3, 300, 3, 100, InternalKey("foo", kBig + 500, kTypeValue), InternalKey("zoo", kBig + 600, kTypeDeletion), kBig + 500, - kBig + 600, true, kInvalidBlobFileNumber, + kBig + 600, true, Temperature::kUnknown, kInvalidBlobFileNumber, kUnknownOldestAncesterTime, kUnknownFileCreationTime, kUnknownFileChecksum, kUnknownFileChecksumFuncName, kDisableUserTimestamp, kDisableUserTimestamp); @@ -211,10 +215,10 @@ TEST_F(VersionEditTest, NewFile4NotSupportedField) { TEST_F(VersionEditTest, EncodeEmptyFile) { VersionEdit edit; edit.AddFile(0, 0, 0, 0, InternalKey(), InternalKey(), 0, 0, false, - kInvalidBlobFileNumber, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, kInvalidBlobFileNumber, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); std::string buffer; ASSERT_TRUE(!edit.EncodeTo(&buffer)); } diff --git a/db/version_set.cc b/db/version_set.cc index 0da8c8751..c0947c071 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -5385,13 +5385,13 @@ Status VersionSet::WriteCurrentStateToManifest( for (int level = 0; level < cfd->NumberLevels(); level++) { for (const auto& f : cfd->current()->storage_info()->LevelFiles(level)) { - edit.AddFile(level, f->fd.GetNumber(), f->fd.GetPathId(), - f->fd.GetFileSize(), f->smallest, f->largest, - f->fd.smallest_seqno, f->fd.largest_seqno, - f->marked_for_compaction, f->oldest_blob_file_number, - f->oldest_ancester_time, f->file_creation_time, - f->file_checksum, f->file_checksum_func_name, - f->min_timestamp, f->max_timestamp); + edit.AddFile( + level, f->fd.GetNumber(), f->fd.GetPathId(), f->fd.GetFileSize(), + f->smallest, f->largest, f->fd.smallest_seqno, + f->fd.largest_seqno, f->marked_for_compaction, f->temperature, + f->oldest_blob_file_number, f->oldest_ancester_time, + f->file_creation_time, f->file_checksum, + f->file_checksum_func_name, f->min_timestamp, f->max_timestamp); } } diff --git a/db/version_set_test.cc b/db/version_set_test.cc index 4d2c4c8cd..9f5bd272e 100644 --- a/db/version_set_test.cc +++ b/db/version_set_test.cc @@ -13,6 +13,7 @@ #include "db/db_impl/db_impl.h" #include "db/log_writer.h" +#include "rocksdb/advanced_options.h" #include "rocksdb/convenience.h" #include "rocksdb/file_system.h" #include "table/block_based/block_based_table_factory.h" @@ -44,10 +45,11 @@ class GenerateLevelFilesBriefTest : public testing::Test { files_.size() + 1, 0, 0, InternalKey(smallest, smallest_seq, kTypeValue), InternalKey(largest, largest_seq, kTypeValue), smallest_seq, - largest_seq, /* marked_for_compact */ false, kInvalidBlobFileNumber, - kUnknownOldestAncesterTime, kUnknownFileCreationTime, - kUnknownFileChecksum, kUnknownFileChecksumFuncName, - kDisableUserTimestamp, kDisableUserTimestamp); + largest_seq, /* marked_for_compact */ false, Temperature::kUnknown, + kInvalidBlobFileNumber, kUnknownOldestAncesterTime, + kUnknownFileCreationTime, kUnknownFileChecksum, + kUnknownFileChecksumFuncName, kDisableUserTimestamp, + kDisableUserTimestamp); files_.push_back(f); } @@ -153,10 +155,10 @@ class VersionStorageInfoTestBase : public testing::Test { FileMetaData* f = new FileMetaData( file_number, 0, file_size, smallest, largest, /* smallest_seq */ 0, /* largest_seq */ 0, /* marked_for_compact */ false, - oldest_blob_file_number, kUnknownOldestAncesterTime, - kUnknownFileCreationTime, kUnknownFileChecksum, - kUnknownFileChecksumFuncName, kDisableUserTimestamp, - kDisableUserTimestamp); + Temperature::kUnknown, oldest_blob_file_number, + kUnknownOldestAncesterTime, kUnknownFileCreationTime, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); f->compensated_file_size = file_size; vstorage_.AddFile(level, f); } @@ -2997,7 +2999,8 @@ class VersionSetTestMissingFiles : public VersionSetTestBase, ASSERT_OK(s); ASSERT_NE(0, file_size); file_metas->emplace_back(file_num, /*file_path_id=*/0, file_size, ikey, - ikey, 0, 0, false, 0, 0, 0, kUnknownFileChecksum, + ikey, 0, 0, false, Temperature::kUnknown, 0, 0, + 0, kUnknownFileChecksum, kUnknownFileChecksumFuncName, kDisableUserTimestamp, kDisableUserTimestamp); } @@ -3051,11 +3054,11 @@ TEST_F(VersionSetTestMissingFiles, ManifestFarBehindSst) { std::string largest_ukey = "b"; InternalKey smallest_ikey(smallest_ukey, 1, ValueType::kTypeValue); InternalKey largest_ikey(largest_ukey, 1, ValueType::kTypeValue); - FileMetaData meta = - FileMetaData(file_num, /*file_path_id=*/0, /*file_size=*/12, - smallest_ikey, largest_ikey, 0, 0, false, 0, 0, 0, - kUnknownFileChecksum, kUnknownFileChecksumFuncName, - kDisableUserTimestamp, kDisableUserTimestamp); + FileMetaData meta = FileMetaData( + file_num, /*file_path_id=*/0, /*file_size=*/12, smallest_ikey, + largest_ikey, 0, 0, false, Temperature::kUnknown, 0, 0, 0, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); added_files.emplace_back(0, meta); } WriteFileAdditionAndDeletionToManifest( @@ -3107,11 +3110,11 @@ TEST_F(VersionSetTestMissingFiles, ManifestAheadofSst) { std::string largest_ukey = "b"; InternalKey smallest_ikey(smallest_ukey, 1, ValueType::kTypeValue); InternalKey largest_ikey(largest_ukey, 1, ValueType::kTypeValue); - FileMetaData meta = - FileMetaData(file_num, /*file_path_id=*/0, /*file_size=*/12, - smallest_ikey, largest_ikey, 0, 0, false, 0, 0, 0, - kUnknownFileChecksum, kUnknownFileChecksumFuncName, - kDisableUserTimestamp, kDisableUserTimestamp); + FileMetaData meta = FileMetaData( + file_num, /*file_path_id=*/0, /*file_size=*/12, smallest_ikey, + largest_ikey, 0, 0, false, Temperature::kUnknown, 0, 0, 0, + kUnknownFileChecksum, kUnknownFileChecksumFuncName, + kDisableUserTimestamp, kDisableUserTimestamp); added_files.emplace_back(0, meta); } WriteFileAdditionAndDeletionToManifest( diff --git a/tools/simulated_hybrid_file_system.cc b/tools/simulated_hybrid_file_system.cc index 7cb992152..a53b8785d 100644 --- a/tools/simulated_hybrid_file_system.cc +++ b/tools/simulated_hybrid_file_system.cc @@ -79,6 +79,7 @@ IOStatus SimulatedHybridFileSystem::NewRandomAccessFile( temperature = Temperature::kWarm; } } + assert(temperature == file_opts.temperature); IOStatus s = target()->NewRandomAccessFile(fname, file_opts, result, dbg); result->reset( new SimulatedHybridRaf(std::move(*result), rate_limiter_, temperature));