3535struct SstFileMetaData {
3636 constexpr static FileIdentifier file_identifier = 3804347 ;
3737 SstFileMetaData ()
38- : size (0 ), file_number( 0 ), smallest_seqno (0 ), largest_seqno (0 ), num_reads_sampled (0 ), being_compacted( false ),
39- num_entries (0 ), num_deletions( 0 ), temperature (0 ), oldest_blob_file_number (0 ), oldest_ancester_time (0 ),
40- file_creation_time(0 ) {}
38+ : file_number (0 ), file_type( 2 ), size (0 ), temperature (0 ), smallest_seqno (0 ), largest_seqno( 0 ),
39+ num_reads_sampled (0 ), being_compacted( false ), num_entries (0 ), num_deletions (0 ), oldest_blob_file_number (0 ),
40+ oldest_ancester_time( 0 ), file_creation_time( 0 ), epoch_number (0 ) {}
4141
42- SstFileMetaData (const std::string& _file_name,
42+ SstFileMetaData (const std::string& _relative_filename,
43+ const std::string& _directory,
4344 uint64_t _file_number,
44- const std::string& _path,
45- size_t _size,
45+ int _file_type,
46+ uint64_t _size,
47+ int _temperature,
48+ std::string& _file_checksum,
49+ std::string& _file_checksum_func_name,
4650 uint64_t _smallest_seqno,
4751 uint64_t _largest_seqno,
4852 const std::string& _smallestkey,
4953 const std::string& _largestkey,
5054 uint64_t _num_reads_sampled,
5155 bool _being_compacted,
52- int _temperature,
56+ uint64_t _num_entries,
57+ uint64_t _num_deletions,
5358 uint64_t _oldest_blob_file_number,
5459 uint64_t _oldest_ancester_time,
5560 uint64_t _file_creation_time,
56- std::string& _file_checksum,
57- std::string& _file_checksum_func_name)
58- : size(_size), name(_file_name), file_number(_file_number), db_path(_path), smallest_seqno(_smallest_seqno),
61+ uint64_t _epoch_number,
62+ const std::string& _name,
63+ const std::string& _db_path)
64+ : relative_filename(_relative_filename), directory(_directory), file_number(_file_number), file_type(_file_type),
65+ size(_size), temperature(_temperature), file_checksum(_file_checksum),
66+ file_checksum_func_name(_file_checksum_func_name), smallest_seqno(_smallest_seqno),
5967 largest_seqno(_largest_seqno), smallestkey(_smallestkey), largestkey(_largestkey),
60- num_reads_sampled(_num_reads_sampled), being_compacted(_being_compacted), num_entries(0 ), num_deletions( 0 ),
61- temperature(_temperature ), oldest_blob_file_number(_oldest_blob_file_number),
68+ num_reads_sampled(_num_reads_sampled), being_compacted(_being_compacted), num_entries(_num_entries ),
69+ num_deletions(_num_deletions ), oldest_blob_file_number(_oldest_blob_file_number),
6270 oldest_ancester_time(_oldest_ancester_time), file_creation_time(_file_creation_time),
63- file_checksum(_file_checksum), file_checksum_func_name(_file_checksum_func_name) {}
64-
65- // File size in bytes.
66- size_t size;
67- // The name of the file.
68- std::string name;
69- // The id of the file.
71+ epoch_number(_epoch_number), name(_name), db_path(_db_path) {}
72+
73+ // The name of the file within its directory (e.g. "123456.sst")
74+ std::string relative_filename;
75+ // The directory containing the file, without a trailing '/'. This could be
76+ // a DB path, wal_dir, etc.
77+ std::string directory;
78+ // The id of the file within a single DB. Set to 0 if the file does not have
79+ // a number (e.g. CURRENT)
7080 uint64_t file_number;
71- // The full path where the file locates.
72- std::string db_path;
81+ // The type of the file as part of a DB.
82+ int file_type;
83+ // File size in bytes. See also `trim_to_size`.
84+ uint64_t size;
85+ // This feature is experimental and subject to change.
86+ int temperature;
87+ // The checksum of a SST file, the value is decided by the file content and
88+ // the checksum algorithm used for this SST file. The checksum function is
89+ // identified by the file_checksum_func_name. If the checksum function is
90+ // not specified, file_checksum is "0" by default.
91+ std::string file_checksum;
92+ // The name of the checksum function used to generate the file checksum
93+ // value. If file checksum is not enabled (e.g., sst_file_checksum_func is
94+ // null), file_checksum_func_name is UnknownFileChecksumFuncName, which is
95+ // "Unknown".
96+ std::string file_checksum_func_name;
7397
7498 uint64_t smallest_seqno; // Smallest sequence number in file.
7599 uint64_t largest_seqno; // Largest sequence number in file.
76100 std::string smallestkey; // Smallest user defined key in the file.
77101 std::string largestkey; // Largest user defined key in the file.
78102 uint64_t num_reads_sampled; // How many times the file is read.
79103 bool being_compacted; // true if the file is currently being compacted.
80-
81104 uint64_t num_entries;
82105 uint64_t num_deletions;
83-
84- // This feature is experimental and subject to change.
85- int temperature;
86-
87106 uint64_t oldest_blob_file_number; // The id of the oldest blob file
88107 // referenced by the file.
89108 // An SST file may be generated by compactions whose input files may
@@ -97,26 +116,30 @@ struct SstFileMetaData {
97116 // Timestamp when the SST file is created, provided by
98117 // SystemClock::GetCurrentTime(). 0 if the information is not available.
99118 uint64_t file_creation_time;
100-
101- // The checksum of a SST file, the value is decided by the file content and
102- // the checksum algorithm used for this SST file. The checksum function is
103- // identified by the file_checksum_func_name. If the checksum function is
104- // not specified, file_checksum is "0" by default .
105- std::string file_checksum ;
106-
107- // The name of the checksum function used to generate the file checksum
108- // value. If file checksum is not enabled (e.g., sst_file_checksum_func is
109- // null), file_checksum_func_name is UnknownFileChecksumFuncName, which is
110- // "Unknown".
111- std::string file_checksum_func_name ;
119+ // The order of a file being flushed or ingested/imported.
120+ // Compaction output file will be assigned with the minimum `epoch_number`
121+ // among input files'.
122+ // For L0, larger `epoch_number` indicates newer L0 file.
123+ // 0 if the information is not available .
124+ uint64_t epoch_number ;
125+ // DEPRECATED: The name of the file within its directory with a
126+ // leading slash (e.g. "/123456.sst"). Use relative_filename from base struct
127+ // instead.
128+ std::string name;
129+ // DEPRECATED: replaced by `directory` in base struct
130+ std::string db_path ;
112131
113132 template <class Ar >
114133 void serialize (Ar& ar) {
115134 serializer (ar,
116- size ,
117- name ,
135+ relative_filename ,
136+ directory ,
118137 file_number,
119- db_path,
138+ file_type,
139+ size,
140+ temperature,
141+ file_checksum,
142+ file_checksum_func_name,
120143 smallest_seqno,
121144 largest_seqno,
122145 smallestkey,
@@ -125,12 +148,12 @@ struct SstFileMetaData {
125148 being_compacted,
126149 num_entries,
127150 num_deletions,
128- temperature,
129151 oldest_blob_file_number,
130152 oldest_ancester_time,
131153 file_creation_time,
132- file_checksum,
133- file_checksum_func_name);
154+ epoch_number,
155+ name,
156+ db_path);
134157 }
135158};
136159
@@ -145,10 +168,14 @@ struct LiveFileMetaData : public SstFileMetaData {
145168 template <class Ar >
146169 void serialize (Ar& ar) {
147170 serializer (ar,
148- SstFileMetaData::size ,
149- SstFileMetaData::name ,
171+ SstFileMetaData::relative_filename ,
172+ SstFileMetaData::directory ,
150173 SstFileMetaData::file_number,
151- SstFileMetaData::db_path,
174+ SstFileMetaData::file_type,
175+ SstFileMetaData::size,
176+ SstFileMetaData::temperature,
177+ SstFileMetaData::file_checksum,
178+ SstFileMetaData::file_checksum_func_name,
152179 SstFileMetaData::smallest_seqno,
153180 SstFileMetaData::largest_seqno,
154181 SstFileMetaData::smallestkey,
@@ -157,12 +184,12 @@ struct LiveFileMetaData : public SstFileMetaData {
157184 SstFileMetaData::being_compacted,
158185 SstFileMetaData::num_entries,
159186 SstFileMetaData::num_deletions,
160- SstFileMetaData::temperature,
161187 SstFileMetaData::oldest_blob_file_number,
162188 SstFileMetaData::oldest_ancester_time,
163189 SstFileMetaData::file_creation_time,
164- SstFileMetaData::file_checksum,
165- SstFileMetaData::file_checksum_func_name,
190+ SstFileMetaData::epoch_number,
191+ SstFileMetaData::name,
192+ SstFileMetaData::db_path,
166193 column_family_name,
167194 level,
168195 fetched);
0 commit comments