mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-05 09:46:53 +00:00
Support multiple DB directories in universal compaction style
Summary: This patch adds a target size parameter in options.db_paths and universal compaction will base it to determine which DB path to place a new file. Level-style stays the same. Test Plan: Add new unit tests Reviewers: ljin, yhchiang Reviewed By: yhchiang Subscribers: MarkCallaghan, dhruba, igor, leveldb Differential Revision: https://reviews.facebook.net/D19869
This commit is contained in:
@@ -83,6 +83,14 @@ enum UpdateStatus { // Return status For inplace update callback
|
||||
UPDATED = 2, // No inplace update. Merged value set
|
||||
};
|
||||
|
||||
struct DbPath {
|
||||
std::string path;
|
||||
uint64_t target_size; // Target size of total files under the path, in byte.
|
||||
|
||||
DbPath() : target_size(0) {}
|
||||
DbPath(const std::string& p, uint64_t t) : path(p), target_size(t) {}
|
||||
};
|
||||
|
||||
struct Options;
|
||||
|
||||
struct ColumnFamilyOptions {
|
||||
@@ -677,12 +685,31 @@ struct DBOptions {
|
||||
// This options is not used!!
|
||||
int db_stats_log_interval;
|
||||
|
||||
// A list paths where SST files can be put into. A compaction style can
|
||||
// determine which of those paths it will put the file to.
|
||||
// A list of paths where SST files can be put into, with its target size.
|
||||
// Newer data is placed into paths specified earlier in the vector while
|
||||
// older data gradually moves to paths specified later in the vector.
|
||||
//
|
||||
// For example, you have a flash device with 10GB allocated for the DB,
|
||||
// as well as a hard drive of 2TB, you should config it to be:
|
||||
// [{"/flash_path", 10GB}, {"/hard_drive", 2TB}]
|
||||
//
|
||||
// The system will try to guarantee data under each path is close to but
|
||||
// not larger than the target size. But current and future file sizes used
|
||||
// by determining where to place a file are based on best-effort estimation,
|
||||
// which means there is a chance that the actual size under the directory
|
||||
// is slightly more than target size under some workloads. User should give
|
||||
// some buffer room for those cases.
|
||||
//
|
||||
// If none of the paths has sufficient room to place a file, the file will
|
||||
// be placed to the last path anyway, despite to the target size.
|
||||
//
|
||||
// Placing newer data to ealier paths is also best-efforts. User should
|
||||
// expect user files to be placed in higher levels in some extreme cases.
|
||||
//
|
||||
// If left empty, only one path will be used, which is db_name passed when
|
||||
// opening the DB.
|
||||
// Default: empty
|
||||
std::vector<std::string> db_paths;
|
||||
std::vector<DbPath> db_paths;
|
||||
|
||||
// This specifies the info LOG dir.
|
||||
// If it is empty, the log files will be in the same dir as data.
|
||||
|
||||
Reference in New Issue
Block a user