Disable WAL (#1765)

* Disable WAL

* Make WAL optional

* Fix tests.

* Update cli.rs
This commit is contained in:
Arkadiy Paronyan
2016-07-29 15:36:00 +02:00
committed by GitHub
parent 29e07755e9
commit 57faa37623
10 changed files with 29 additions and 5 deletions

View File

@@ -93,6 +93,8 @@ pub struct DatabaseConfig {
pub compaction: CompactionProfile,
/// Set number of columns
pub columns: Option<u32>,
/// Should we keep WAL enabled?
pub wal: bool,
}
impl DatabaseConfig {
@@ -111,6 +113,7 @@ impl Default for DatabaseConfig {
max_open_files: 1024,
compaction: CompactionProfile::default(),
columns: None,
wal: true,
}
}
}
@@ -167,7 +170,9 @@ impl Database {
}
let mut write_opts = WriteOptions::new();
write_opts.disable_wal(true); // TODO: make sure this is safe
if !config.wal {
write_opts.disable_wal(true);
}
let mut cfs: Vec<Column> = Vec::new();
let db = match config.columns {

View File

@@ -213,6 +213,7 @@ impl Manager {
cache_size: None,
compaction: config.compaction_profile,
columns: columns,
wal: true,
};
let db_root = database_path(old_path);