RocksDB 7.10.2 version upgrade (#9828)

This commit is contained in:
neethuhaneesha 2023-04-03 10:01:22 -07:00 committed by GitHub
parent c55cc23b47
commit 44fba4e84c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 140 additions and 91 deletions

View File

@ -1,6 +1,6 @@
# FindRocksDB # FindRocksDB
find_package(RocksDB 7.7.3) find_package(RocksDB 7.10.2)
include(ExternalProject) include(ExternalProject)
@ -52,8 +52,8 @@ if(ROCKSDB_FOUND)
${BINARY_DIR}/librocksdb.a) ${BINARY_DIR}/librocksdb.a)
else() else()
ExternalProject_Add(rocksdb ExternalProject_Add(rocksdb
URL https://github.com/facebook/rocksdb/archive/refs/tags/v7.7.3.tar.gz URL https://github.com/facebook/rocksdb/archive/refs/tags/v7.10.2.tar.gz
URL_HASH SHA256=b8ac9784a342b2e314c821f6d701148912215666ac5e9bdbccd93cf3767cb611 URL_HASH SHA256=4619ae7308cd3d11cdd36f0bfad3fb03a1ad399ca333f192b77b6b95b08e2f78
CMAKE_ARGS ${RocksDB_CMAKE_ARGS} CMAKE_ARGS ${RocksDB_CMAKE_ARGS}
BUILD_BYPRODUCTS <BINARY_DIR>/librocksdb.a BUILD_BYPRODUCTS <BINARY_DIR>/librocksdb.a
INSTALL_COMMAND "" INSTALL_COMMAND ""

View File

@ -13,6 +13,8 @@ Release Notes
* Fixed unnecessary transaction system recovery when excluding the servers that are already excluded/failed. `(PR #9809) <https://github.com/apple/foundationdb/pull/9809>`_ * Fixed unnecessary transaction system recovery when excluding the servers that are already excluded/failed. `(PR #9809) <https://github.com/apple/foundationdb/pull/9809>`_
* Fixed the exclusion of stateless processes by skipping the free capacity check. `(PR #9789) <https://github.com/apple/foundationdb/pull/9789>`_ * Fixed the exclusion of stateless processes by skipping the free capacity check. `(PR #9789) <https://github.com/apple/foundationdb/pull/9789>`_
* Fixed an issue where the new worker cannot get ServerDBInfo update. `(PR #9778) <https://github.com/apple/foundationdb/pull/9778>`_ * Fixed an issue where the new worker cannot get ServerDBInfo update. `(PR #9778) <https://github.com/apple/foundationdb/pull/9778>`_
* Added RocksDB bloom filter knobs. `(PR #9770) <https://github.com/apple/foundationdb/pull/9770>`_
* Upgraded RocksDB to version 7.10.2. `(PR #9829) <https://github.com/apple/foundationdb/pull/9829>`_
7.1.29 7.1.29
====== ======

View File

@ -69,9 +69,9 @@
#ifdef SSD_ROCKSDB_EXPERIMENTAL #ifdef SSD_ROCKSDB_EXPERIMENTAL
// Enforcing rocksdb version to be 7.7.3. // Enforcing rocksdb version to be 7.10.2
static_assert((ROCKSDB_MAJOR == 7 && ROCKSDB_MINOR == 7 && ROCKSDB_PATCH == 3), static_assert((ROCKSDB_MAJOR == 7 && ROCKSDB_MINOR == 10 && ROCKSDB_PATCH == 2),
"Unsupported rocksdb version. Update the rocksdb to 7.7.3 version"); "Unsupported rocksdb version. Update the rocksdb to 7.10.2 version");
namespace { namespace {
using rocksdb::BackgroundErrorReason; using rocksdb::BackgroundErrorReason;
@ -360,10 +360,14 @@ rocksdb::ExportImportFilesMetaData getMetaData(const CheckpointMetaData& checkpo
for (const LiveFileMetaData& fileMetaData : rocksCF.sstFiles) { for (const LiveFileMetaData& fileMetaData : rocksCF.sstFiles) {
rocksdb::LiveFileMetaData liveFileMetaData; rocksdb::LiveFileMetaData liveFileMetaData;
liveFileMetaData.size = fileMetaData.size; liveFileMetaData.relative_filename = fileMetaData.relative_filename;
liveFileMetaData.name = fileMetaData.name; liveFileMetaData.directory = fileMetaData.directory;
liveFileMetaData.file_number = fileMetaData.file_number; liveFileMetaData.file_number = fileMetaData.file_number;
liveFileMetaData.db_path = fileMetaData.db_path; liveFileMetaData.file_type = static_cast<rocksdb::FileType>(fileMetaData.file_type);
liveFileMetaData.size = fileMetaData.size;
liveFileMetaData.temperature = static_cast<rocksdb::Temperature>(fileMetaData.temperature);
liveFileMetaData.file_checksum = fileMetaData.file_checksum;
liveFileMetaData.file_checksum_func_name = fileMetaData.file_checksum_func_name;
liveFileMetaData.smallest_seqno = fileMetaData.smallest_seqno; liveFileMetaData.smallest_seqno = fileMetaData.smallest_seqno;
liveFileMetaData.largest_seqno = fileMetaData.largest_seqno; liveFileMetaData.largest_seqno = fileMetaData.largest_seqno;
liveFileMetaData.smallestkey = fileMetaData.smallestkey; liveFileMetaData.smallestkey = fileMetaData.smallestkey;
@ -372,12 +376,12 @@ rocksdb::ExportImportFilesMetaData getMetaData(const CheckpointMetaData& checkpo
liveFileMetaData.being_compacted = fileMetaData.being_compacted; liveFileMetaData.being_compacted = fileMetaData.being_compacted;
liveFileMetaData.num_entries = fileMetaData.num_entries; liveFileMetaData.num_entries = fileMetaData.num_entries;
liveFileMetaData.num_deletions = fileMetaData.num_deletions; liveFileMetaData.num_deletions = fileMetaData.num_deletions;
liveFileMetaData.temperature = static_cast<rocksdb::Temperature>(fileMetaData.temperature);
liveFileMetaData.oldest_blob_file_number = fileMetaData.oldest_blob_file_number; liveFileMetaData.oldest_blob_file_number = fileMetaData.oldest_blob_file_number;
liveFileMetaData.oldest_ancester_time = fileMetaData.oldest_ancester_time; liveFileMetaData.oldest_ancester_time = fileMetaData.oldest_ancester_time;
liveFileMetaData.file_creation_time = fileMetaData.file_creation_time; liveFileMetaData.file_creation_time = fileMetaData.file_creation_time;
liveFileMetaData.file_checksum = fileMetaData.file_checksum; liveFileMetaData.epoch_number = fileMetaData.epoch_number;
liveFileMetaData.file_checksum_func_name = fileMetaData.file_checksum_func_name; liveFileMetaData.name = fileMetaData.name;
liveFileMetaData.db_path = fileMetaData.db_path;
liveFileMetaData.column_family_name = fileMetaData.column_family_name; liveFileMetaData.column_family_name = fileMetaData.column_family_name;
liveFileMetaData.level = fileMetaData.level; liveFileMetaData.level = fileMetaData.level;
metaData.files.push_back(liveFileMetaData); metaData.files.push_back(liveFileMetaData);
@ -391,10 +395,14 @@ void populateMetaData(CheckpointMetaData* checkpoint, const rocksdb::ExportImpor
rocksCF.dbComparatorName = metaData.db_comparator_name; rocksCF.dbComparatorName = metaData.db_comparator_name;
for (const rocksdb::LiveFileMetaData& fileMetaData : metaData.files) { for (const rocksdb::LiveFileMetaData& fileMetaData : metaData.files) {
LiveFileMetaData liveFileMetaData; LiveFileMetaData liveFileMetaData;
liveFileMetaData.size = fileMetaData.size; liveFileMetaData.relative_filename = fileMetaData.relative_filename;
liveFileMetaData.name = fileMetaData.name; liveFileMetaData.directory = fileMetaData.directory;
liveFileMetaData.file_number = fileMetaData.file_number; liveFileMetaData.file_number = fileMetaData.file_number;
liveFileMetaData.db_path = fileMetaData.db_path; liveFileMetaData.file_type = static_cast<int>(fileMetaData.file_type);
liveFileMetaData.size = fileMetaData.size;
liveFileMetaData.temperature = static_cast<uint8_t>(fileMetaData.temperature);
liveFileMetaData.file_checksum = fileMetaData.file_checksum;
liveFileMetaData.file_checksum_func_name = fileMetaData.file_checksum_func_name;
liveFileMetaData.smallest_seqno = fileMetaData.smallest_seqno; liveFileMetaData.smallest_seqno = fileMetaData.smallest_seqno;
liveFileMetaData.largest_seqno = fileMetaData.largest_seqno; liveFileMetaData.largest_seqno = fileMetaData.largest_seqno;
liveFileMetaData.smallestkey = fileMetaData.smallestkey; liveFileMetaData.smallestkey = fileMetaData.smallestkey;
@ -403,12 +411,12 @@ void populateMetaData(CheckpointMetaData* checkpoint, const rocksdb::ExportImpor
liveFileMetaData.being_compacted = fileMetaData.being_compacted; liveFileMetaData.being_compacted = fileMetaData.being_compacted;
liveFileMetaData.num_entries = fileMetaData.num_entries; liveFileMetaData.num_entries = fileMetaData.num_entries;
liveFileMetaData.num_deletions = fileMetaData.num_deletions; liveFileMetaData.num_deletions = fileMetaData.num_deletions;
liveFileMetaData.temperature = static_cast<uint8_t>(fileMetaData.temperature);
liveFileMetaData.oldest_blob_file_number = fileMetaData.oldest_blob_file_number; liveFileMetaData.oldest_blob_file_number = fileMetaData.oldest_blob_file_number;
liveFileMetaData.oldest_ancester_time = fileMetaData.oldest_ancester_time; liveFileMetaData.oldest_ancester_time = fileMetaData.oldest_ancester_time;
liveFileMetaData.file_creation_time = fileMetaData.file_creation_time; liveFileMetaData.file_creation_time = fileMetaData.file_creation_time;
liveFileMetaData.file_checksum = fileMetaData.file_checksum; liveFileMetaData.epoch_number = fileMetaData.epoch_number;
liveFileMetaData.file_checksum_func_name = fileMetaData.file_checksum_func_name; liveFileMetaData.name = fileMetaData.name;
liveFileMetaData.db_path = fileMetaData.db_path;
liveFileMetaData.column_family_name = fileMetaData.column_family_name; liveFileMetaData.column_family_name = fileMetaData.column_family_name;
liveFileMetaData.level = fileMetaData.level; liveFileMetaData.level = fileMetaData.level;
rocksCF.sstFiles.push_back(liveFileMetaData); rocksCF.sstFiles.push_back(liveFileMetaData);

View File

@ -44,9 +44,9 @@
#ifdef SSD_ROCKSDB_EXPERIMENTAL #ifdef SSD_ROCKSDB_EXPERIMENTAL
// Enforcing rocksdb version to be 7.7.3. // Enforcing rocksdb version to be 7.10.2
static_assert((ROCKSDB_MAJOR == 7 && ROCKSDB_MINOR == 7 && ROCKSDB_PATCH == 3), static_assert((ROCKSDB_MAJOR == 7 && ROCKSDB_MINOR == 10 && ROCKSDB_PATCH == 2),
"Unsupported rocksdb version. Update the rocksdb to 7.7.3 version"); "Unsupported rocksdb version. Update the rocksdb to 7.10.2 version");
const std::string rocksDataFolderSuffix = "-data"; const std::string rocksDataFolderSuffix = "-data";
const std::string METADATA_SHARD_ID = "kvs-metadata"; const std::string METADATA_SHARD_ID = "kvs-metadata";
@ -168,10 +168,14 @@ rocksdb::ExportImportFilesMetaData getMetaData(const CheckpointMetaData& checkpo
for (const LiveFileMetaData& fileMetaData : rocksCF.sstFiles) { for (const LiveFileMetaData& fileMetaData : rocksCF.sstFiles) {
rocksdb::LiveFileMetaData liveFileMetaData; rocksdb::LiveFileMetaData liveFileMetaData;
liveFileMetaData.size = fileMetaData.size; liveFileMetaData.relative_filename = fileMetaData.relative_filename;
liveFileMetaData.name = fileMetaData.name; liveFileMetaData.directory = fileMetaData.directory;
liveFileMetaData.file_number = fileMetaData.file_number; liveFileMetaData.file_number = fileMetaData.file_number;
liveFileMetaData.db_path = fileMetaData.db_path; liveFileMetaData.file_type = static_cast<rocksdb::FileType>(fileMetaData.file_type);
liveFileMetaData.size = fileMetaData.size;
liveFileMetaData.temperature = static_cast<rocksdb::Temperature>(fileMetaData.temperature);
liveFileMetaData.file_checksum = fileMetaData.file_checksum;
liveFileMetaData.file_checksum_func_name = fileMetaData.file_checksum_func_name;
liveFileMetaData.smallest_seqno = fileMetaData.smallest_seqno; liveFileMetaData.smallest_seqno = fileMetaData.smallest_seqno;
liveFileMetaData.largest_seqno = fileMetaData.largest_seqno; liveFileMetaData.largest_seqno = fileMetaData.largest_seqno;
liveFileMetaData.smallestkey = fileMetaData.smallestkey; liveFileMetaData.smallestkey = fileMetaData.smallestkey;
@ -180,12 +184,12 @@ rocksdb::ExportImportFilesMetaData getMetaData(const CheckpointMetaData& checkpo
liveFileMetaData.being_compacted = fileMetaData.being_compacted; liveFileMetaData.being_compacted = fileMetaData.being_compacted;
liveFileMetaData.num_entries = fileMetaData.num_entries; liveFileMetaData.num_entries = fileMetaData.num_entries;
liveFileMetaData.num_deletions = fileMetaData.num_deletions; liveFileMetaData.num_deletions = fileMetaData.num_deletions;
liveFileMetaData.temperature = static_cast<rocksdb::Temperature>(fileMetaData.temperature);
liveFileMetaData.oldest_blob_file_number = fileMetaData.oldest_blob_file_number; liveFileMetaData.oldest_blob_file_number = fileMetaData.oldest_blob_file_number;
liveFileMetaData.oldest_ancester_time = fileMetaData.oldest_ancester_time; liveFileMetaData.oldest_ancester_time = fileMetaData.oldest_ancester_time;
liveFileMetaData.file_creation_time = fileMetaData.file_creation_time; liveFileMetaData.file_creation_time = fileMetaData.file_creation_time;
liveFileMetaData.file_checksum = fileMetaData.file_checksum; liveFileMetaData.epoch_number = fileMetaData.epoch_number;
liveFileMetaData.file_checksum_func_name = fileMetaData.file_checksum_func_name; liveFileMetaData.name = fileMetaData.name;
liveFileMetaData.db_path = fileMetaData.db_path;
liveFileMetaData.column_family_name = fileMetaData.column_family_name; liveFileMetaData.column_family_name = fileMetaData.column_family_name;
liveFileMetaData.level = fileMetaData.level; liveFileMetaData.level = fileMetaData.level;
metaData.files.push_back(liveFileMetaData); metaData.files.push_back(liveFileMetaData);
@ -199,10 +203,14 @@ void populateMetaData(CheckpointMetaData* checkpoint, const rocksdb::ExportImpor
rocksCF.dbComparatorName = metaData.db_comparator_name; rocksCF.dbComparatorName = metaData.db_comparator_name;
for (const rocksdb::LiveFileMetaData& fileMetaData : metaData.files) { for (const rocksdb::LiveFileMetaData& fileMetaData : metaData.files) {
LiveFileMetaData liveFileMetaData; LiveFileMetaData liveFileMetaData;
liveFileMetaData.size = fileMetaData.size; liveFileMetaData.relative_filename = fileMetaData.relative_filename;
liveFileMetaData.name = fileMetaData.name; liveFileMetaData.directory = fileMetaData.directory;
liveFileMetaData.file_number = fileMetaData.file_number; liveFileMetaData.file_number = fileMetaData.file_number;
liveFileMetaData.db_path = fileMetaData.db_path; liveFileMetaData.file_type = static_cast<int>(fileMetaData.file_type);
liveFileMetaData.size = fileMetaData.size;
liveFileMetaData.temperature = static_cast<uint8_t>(fileMetaData.temperature);
liveFileMetaData.file_checksum = fileMetaData.file_checksum;
liveFileMetaData.file_checksum_func_name = fileMetaData.file_checksum_func_name;
liveFileMetaData.smallest_seqno = fileMetaData.smallest_seqno; liveFileMetaData.smallest_seqno = fileMetaData.smallest_seqno;
liveFileMetaData.largest_seqno = fileMetaData.largest_seqno; liveFileMetaData.largest_seqno = fileMetaData.largest_seqno;
liveFileMetaData.smallestkey = fileMetaData.smallestkey; liveFileMetaData.smallestkey = fileMetaData.smallestkey;
@ -211,12 +219,12 @@ void populateMetaData(CheckpointMetaData* checkpoint, const rocksdb::ExportImpor
liveFileMetaData.being_compacted = fileMetaData.being_compacted; liveFileMetaData.being_compacted = fileMetaData.being_compacted;
liveFileMetaData.num_entries = fileMetaData.num_entries; liveFileMetaData.num_entries = fileMetaData.num_entries;
liveFileMetaData.num_deletions = fileMetaData.num_deletions; liveFileMetaData.num_deletions = fileMetaData.num_deletions;
liveFileMetaData.temperature = static_cast<uint8_t>(fileMetaData.temperature);
liveFileMetaData.oldest_blob_file_number = fileMetaData.oldest_blob_file_number; liveFileMetaData.oldest_blob_file_number = fileMetaData.oldest_blob_file_number;
liveFileMetaData.oldest_ancester_time = fileMetaData.oldest_ancester_time; liveFileMetaData.oldest_ancester_time = fileMetaData.oldest_ancester_time;
liveFileMetaData.file_creation_time = fileMetaData.file_creation_time; liveFileMetaData.file_creation_time = fileMetaData.file_creation_time;
liveFileMetaData.file_checksum = fileMetaData.file_checksum; liveFileMetaData.epoch_number = fileMetaData.epoch_number;
liveFileMetaData.file_checksum_func_name = fileMetaData.file_checksum_func_name; liveFileMetaData.name = fileMetaData.name;
liveFileMetaData.db_path = fileMetaData.db_path;
liveFileMetaData.column_family_name = fileMetaData.column_family_name; liveFileMetaData.column_family_name = fileMetaData.column_family_name;
liveFileMetaData.level = fileMetaData.level; liveFileMetaData.level = fileMetaData.level;
rocksCF.sstFiles.push_back(liveFileMetaData); rocksCF.sstFiles.push_back(liveFileMetaData);

View File

@ -45,9 +45,9 @@
#include "flow/actorcompiler.h" // has to be last include #include "flow/actorcompiler.h" // has to be last include
#ifdef SSD_ROCKSDB_EXPERIMENTAL #ifdef SSD_ROCKSDB_EXPERIMENTAL
// Enforcing rocksdb version to be 7.7.3. // Enforcing rocksdb version to be 7.10.2
static_assert((ROCKSDB_MAJOR == 7 && ROCKSDB_MINOR == 7 && ROCKSDB_PATCH == 3), static_assert((ROCKSDB_MAJOR == 7 && ROCKSDB_MINOR == 10 && ROCKSDB_PATCH == 2),
"Unsupported rocksdb version. Update the rocksdb to 7.7.3 version"); "Unsupported rocksdb version. Update the rocksdb to 7.10.2 version");
namespace { namespace {
@ -71,10 +71,14 @@ rocksdb::ExportImportFilesMetaData getMetaData(const CheckpointMetaData& checkpo
for (const LiveFileMetaData& fileMetaData : rocksCF.sstFiles) { for (const LiveFileMetaData& fileMetaData : rocksCF.sstFiles) {
rocksdb::LiveFileMetaData liveFileMetaData; rocksdb::LiveFileMetaData liveFileMetaData;
liveFileMetaData.size = fileMetaData.size; liveFileMetaData.relative_filename = fileMetaData.relative_filename;
liveFileMetaData.name = fileMetaData.name; liveFileMetaData.directory = fileMetaData.directory;
liveFileMetaData.file_number = fileMetaData.file_number; liveFileMetaData.file_number = fileMetaData.file_number;
liveFileMetaData.db_path = fileMetaData.db_path; liveFileMetaData.file_type = static_cast<rocksdb::FileType>(fileMetaData.file_type);
liveFileMetaData.size = fileMetaData.size;
liveFileMetaData.temperature = static_cast<rocksdb::Temperature>(fileMetaData.temperature);
liveFileMetaData.file_checksum = fileMetaData.file_checksum;
liveFileMetaData.file_checksum_func_name = fileMetaData.file_checksum_func_name;
liveFileMetaData.smallest_seqno = fileMetaData.smallest_seqno; liveFileMetaData.smallest_seqno = fileMetaData.smallest_seqno;
liveFileMetaData.largest_seqno = fileMetaData.largest_seqno; liveFileMetaData.largest_seqno = fileMetaData.largest_seqno;
liveFileMetaData.smallestkey = fileMetaData.smallestkey; liveFileMetaData.smallestkey = fileMetaData.smallestkey;
@ -83,12 +87,12 @@ rocksdb::ExportImportFilesMetaData getMetaData(const CheckpointMetaData& checkpo
liveFileMetaData.being_compacted = fileMetaData.being_compacted; liveFileMetaData.being_compacted = fileMetaData.being_compacted;
liveFileMetaData.num_entries = fileMetaData.num_entries; liveFileMetaData.num_entries = fileMetaData.num_entries;
liveFileMetaData.num_deletions = fileMetaData.num_deletions; liveFileMetaData.num_deletions = fileMetaData.num_deletions;
liveFileMetaData.temperature = static_cast<rocksdb::Temperature>(fileMetaData.temperature);
liveFileMetaData.oldest_blob_file_number = fileMetaData.oldest_blob_file_number; liveFileMetaData.oldest_blob_file_number = fileMetaData.oldest_blob_file_number;
liveFileMetaData.oldest_ancester_time = fileMetaData.oldest_ancester_time; liveFileMetaData.oldest_ancester_time = fileMetaData.oldest_ancester_time;
liveFileMetaData.file_creation_time = fileMetaData.file_creation_time; liveFileMetaData.file_creation_time = fileMetaData.file_creation_time;
liveFileMetaData.file_checksum = fileMetaData.file_checksum; liveFileMetaData.epoch_number = fileMetaData.epoch_number;
liveFileMetaData.file_checksum_func_name = fileMetaData.file_checksum_func_name; liveFileMetaData.name = fileMetaData.name;
liveFileMetaData.db_path = fileMetaData.db_path;
liveFileMetaData.column_family_name = fileMetaData.column_family_name; liveFileMetaData.column_family_name = fileMetaData.column_family_name;
liveFileMetaData.level = fileMetaData.level; liveFileMetaData.level = fileMetaData.level;
metaData.files.push_back(liveFileMetaData); metaData.files.push_back(liveFileMetaData);

View File

@ -77,41 +77,65 @@ struct CheckpointFile {
struct SstFileMetaData { struct SstFileMetaData {
constexpr static FileIdentifier file_identifier = 3804347; constexpr static FileIdentifier file_identifier = 3804347;
SstFileMetaData() SstFileMetaData()
: size(0), file_number(0), smallest_seqno(0), largest_seqno(0), num_reads_sampled(0), being_compacted(false), : file_number(0), file_type(2), size(0), temperature(0), smallest_seqno(0), largest_seqno(0),
num_entries(0), num_deletions(0), temperature(0), oldest_blob_file_number(0), oldest_ancester_time(0), num_reads_sampled(0), being_compacted(false), num_entries(0), num_deletions(0), oldest_blob_file_number(0),
file_creation_time(0) {} oldest_ancester_time(0), file_creation_time(0), epoch_number(0) {}
SstFileMetaData(const std::string& _file_name, SstFileMetaData(const std::string& _relative_filename,
const std::string& _directory,
uint64_t _file_number, uint64_t _file_number,
const std::string& _path, int _file_type,
size_t _size, uint64_t _size,
int _temperature,
std::string& _file_checksum,
std::string& _file_checksum_func_name,
uint64_t _smallest_seqno, uint64_t _smallest_seqno,
uint64_t _largest_seqno, uint64_t _largest_seqno,
const std::string& _smallestkey, const std::string& _smallestkey,
const std::string& _largestkey, const std::string& _largestkey,
uint64_t _num_reads_sampled, uint64_t _num_reads_sampled,
bool _being_compacted, bool _being_compacted,
int _temperature, uint64_t _num_entries,
uint64_t _num_deletions,
uint64_t _oldest_blob_file_number, uint64_t _oldest_blob_file_number,
uint64_t _oldest_ancester_time, uint64_t _oldest_ancester_time,
uint64_t _file_creation_time, uint64_t _file_creation_time,
std::string& _file_checksum, uint64_t _epoch_number,
std::string& _file_checksum_func_name) const std::string& _name,
: size(_size), name(_file_name), file_number(_file_number), db_path(_path), smallest_seqno(_smallest_seqno), const std::string& _db_path)
: relative_filename(_relative_filename), directory(_directory), file_number(_file_number), file_type(_file_type),
size(_size), temperature(_temperature), file_checksum(_file_checksum),
file_checksum_func_name(_file_checksum_func_name), smallest_seqno(_smallest_seqno),
largest_seqno(_largest_seqno), smallestkey(_smallestkey), largestkey(_largestkey), largest_seqno(_largest_seqno), smallestkey(_smallestkey), largestkey(_largestkey),
num_reads_sampled(_num_reads_sampled), being_compacted(_being_compacted), num_entries(0), num_deletions(0), num_reads_sampled(_num_reads_sampled), being_compacted(_being_compacted), num_entries(_num_entries),
temperature(_temperature), oldest_blob_file_number(_oldest_blob_file_number), num_deletions(_num_deletions), oldest_blob_file_number(_oldest_blob_file_number),
oldest_ancester_time(_oldest_ancester_time), file_creation_time(_file_creation_time), oldest_ancester_time(_oldest_ancester_time), file_creation_time(_file_creation_time),
file_checksum(_file_checksum), file_checksum_func_name(_file_checksum_func_name) {} epoch_number(_epoch_number), name(_name), db_path(_db_path) {}
// File size in bytes. // The name of the file within its directory (e.g. "123456.sst")
size_t size; std::string relative_filename;
// The name of the file. // The directory containing the file, without a trailing '/'. This could be
std::string name; // a DB path, wal_dir, etc.
// The id of the file. std::string directory;
// The id of the file within a single DB. Set to 0 if the file does not have
// a number (e.g. CURRENT)
uint64_t file_number; uint64_t file_number;
// The full path where the file locates. // The type of the file as part of a DB.
std::string db_path; int file_type;
// File size in bytes. See also `trim_to_size`.
uint64_t size;
// This feature is experimental and subject to change.
int temperature;
// The checksum of a SST file, the value is decided by the file content and
// the checksum algorithm used for this SST file. The checksum function is
// identified by the file_checksum_func_name. If the checksum function is
// not specified, file_checksum is "0" by default.
std::string file_checksum;
// The name of the checksum function used to generate the file checksum
// value. If file checksum is not enabled (e.g., sst_file_checksum_func is
// null), file_checksum_func_name is UnknownFileChecksumFuncName, which is
// "Unknown".
std::string file_checksum_func_name;
uint64_t smallest_seqno; // Smallest sequence number in file. uint64_t smallest_seqno; // Smallest sequence number in file.
uint64_t largest_seqno; // Largest sequence number in file. uint64_t largest_seqno; // Largest sequence number in file.
@ -119,13 +143,8 @@ struct SstFileMetaData {
std::string largestkey; // Largest user defined key in the file. std::string largestkey; // Largest user defined key in the file.
uint64_t num_reads_sampled; // How many times the file is read. uint64_t num_reads_sampled; // How many times the file is read.
bool being_compacted; // true if the file is currently being compacted. bool being_compacted; // true if the file is currently being compacted.
uint64_t num_entries; uint64_t num_entries;
uint64_t num_deletions; uint64_t num_deletions;
// This feature is experimental and subject to change.
int temperature;
uint64_t oldest_blob_file_number; // The id of the oldest blob file uint64_t oldest_blob_file_number; // The id of the oldest blob file
// referenced by the file. // referenced by the file.
// An SST file may be generated by compactions whose input files may // An SST file may be generated by compactions whose input files may
@ -139,26 +158,30 @@ struct SstFileMetaData {
// Timestamp when the SST file is created, provided by // Timestamp when the SST file is created, provided by
// SystemClock::GetCurrentTime(). 0 if the information is not available. // SystemClock::GetCurrentTime(). 0 if the information is not available.
uint64_t file_creation_time; uint64_t file_creation_time;
// The order of a file being flushed or ingested/imported.
// The checksum of a SST file, the value is decided by the file content and // Compaction output file will be assigned with the minimum `epoch_number`
// the checksum algorithm used for this SST file. The checksum function is // among input files'.
// identified by the file_checksum_func_name. If the checksum function is // For L0, larger `epoch_number` indicates newer L0 file.
// not specified, file_checksum is "0" by default. // 0 if the information is not available.
std::string file_checksum; uint64_t epoch_number;
// DEPRECATED: The name of the file within its directory with a
// The name of the checksum function used to generate the file checksum // leading slash (e.g. "/123456.sst"). Use relative_filename from base struct
// value. If file checksum is not enabled (e.g., sst_file_checksum_func is // instead.
// null), file_checksum_func_name is UnknownFileChecksumFuncName, which is std::string name;
// "Unknown". // DEPRECATED: replaced by `directory` in base struct
std::string file_checksum_func_name; std::string db_path;
template <class Ar> template <class Ar>
void serialize(Ar& ar) { void serialize(Ar& ar) {
serializer(ar, serializer(ar,
size, relative_filename,
name, directory,
file_number, file_number,
db_path, file_type,
size,
temperature,
file_checksum,
file_checksum_func_name,
smallest_seqno, smallest_seqno,
largest_seqno, largest_seqno,
smallestkey, smallestkey,
@ -167,12 +190,12 @@ struct SstFileMetaData {
being_compacted, being_compacted,
num_entries, num_entries,
num_deletions, num_deletions,
temperature,
oldest_blob_file_number, oldest_blob_file_number,
oldest_ancester_time, oldest_ancester_time,
file_creation_time, file_creation_time,
file_checksum, epoch_number,
file_checksum_func_name); name,
db_path);
} }
}; };
@ -187,10 +210,14 @@ struct LiveFileMetaData : public SstFileMetaData {
template <class Ar> template <class Ar>
void serialize(Ar& ar) { void serialize(Ar& ar) {
serializer(ar, serializer(ar,
SstFileMetaData::size, SstFileMetaData::relative_filename,
SstFileMetaData::name, SstFileMetaData::directory,
SstFileMetaData::file_number, SstFileMetaData::file_number,
SstFileMetaData::db_path, SstFileMetaData::file_type,
SstFileMetaData::size,
SstFileMetaData::temperature,
SstFileMetaData::file_checksum,
SstFileMetaData::file_checksum_func_name,
SstFileMetaData::smallest_seqno, SstFileMetaData::smallest_seqno,
SstFileMetaData::largest_seqno, SstFileMetaData::largest_seqno,
SstFileMetaData::smallestkey, SstFileMetaData::smallestkey,
@ -199,12 +226,12 @@ struct LiveFileMetaData : public SstFileMetaData {
SstFileMetaData::being_compacted, SstFileMetaData::being_compacted,
SstFileMetaData::num_entries, SstFileMetaData::num_entries,
SstFileMetaData::num_deletions, SstFileMetaData::num_deletions,
SstFileMetaData::temperature,
SstFileMetaData::oldest_blob_file_number, SstFileMetaData::oldest_blob_file_number,
SstFileMetaData::oldest_ancester_time, SstFileMetaData::oldest_ancester_time,
SstFileMetaData::file_creation_time, SstFileMetaData::file_creation_time,
SstFileMetaData::file_checksum, SstFileMetaData::epoch_number,
SstFileMetaData::file_checksum_func_name, SstFileMetaData::name,
SstFileMetaData::db_path,
column_family_name, column_family_name,
level, level,
fetched); fetched);