* compaction profile used during migration, fixes #1750 * whitespace [ci:skip]
This commit is contained in:
@@ -52,6 +52,7 @@ impl DBTransaction {
|
||||
}
|
||||
|
||||
/// Compaction profile for the database settings
|
||||
#[derive(Clone)]
|
||||
pub struct CompactionProfile {
|
||||
/// L0-L1 target file size
|
||||
pub initial_file_size: u64,
|
||||
@@ -61,16 +62,18 @@ pub struct CompactionProfile {
|
||||
pub write_rate_limit: Option<u64>,
|
||||
}
|
||||
|
||||
impl CompactionProfile {
|
||||
impl Default for CompactionProfile {
|
||||
/// Default profile suitable for most storage
|
||||
pub fn default() -> CompactionProfile {
|
||||
fn default() -> CompactionProfile {
|
||||
CompactionProfile {
|
||||
initial_file_size: 32 * 1024 * 1024,
|
||||
file_size_multiplier: 2,
|
||||
write_rate_limit: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CompactionProfile {
|
||||
/// Slow hdd compaction profile
|
||||
pub fn hdd() -> CompactionProfile {
|
||||
CompactionProfile {
|
||||
|
||||
@@ -29,12 +29,15 @@ use ::kvdb::{CompactionProfile, Database, DatabaseConfig, DBTransaction};
|
||||
pub struct Config {
|
||||
/// Defines how many elements should be migrated at once.
|
||||
pub batch_size: usize,
|
||||
/// Database compaction profile.
|
||||
pub compaction_profile: CompactionProfile,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Config {
|
||||
batch_size: 1024,
|
||||
compaction_profile: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,7 +202,7 @@ impl Manager {
|
||||
let db_config = DatabaseConfig {
|
||||
max_open_files: 64,
|
||||
cache_size: None,
|
||||
compaction: CompactionProfile::default(),
|
||||
compaction: config.compaction_profile.clone(),
|
||||
};
|
||||
|
||||
let db_root = database_path(old_path);
|
||||
|
||||
Reference in New Issue
Block a user