[rocksdb/speedb] Define keep_log_file_num. Default to 20 (#3064)
This commit is contained in:
parent
07a0087c1b
commit
e4aa85a843
4 changed files with 18 additions and 0 deletions
|
@ -55,3 +55,10 @@ pub static ROCKSDB_MIN_BLOB_SIZE: Lazy<u64> = Lazy::new(|| {
|
|||
.map(|v| v.parse::<u64>().unwrap_or(default))
|
||||
.unwrap_or(default)
|
||||
});
|
||||
|
||||
pub static ROCKSDB_KEEP_LOG_FILE_NUM: Lazy<usize> = Lazy::new(|| {
|
||||
let default = 20;
|
||||
std::env::var("SURREAL_ROCKSDB_KEEP_LOG_FILE_NUM")
|
||||
.map(|v| v.parse::<usize>().unwrap_or(default))
|
||||
.unwrap_or(default)
|
||||
});
|
||||
|
|
|
@ -79,6 +79,8 @@ impl Datastore {
|
|||
opts.set_use_fsync(false);
|
||||
// Only use warning log level
|
||||
opts.set_log_level(LogLevel::Warn);
|
||||
// Set the number of log files to keep
|
||||
opts.set_keep_log_file_num(*cnf::ROCKSDB_KEEP_LOG_FILE_NUM);
|
||||
// Create database if missing
|
||||
opts.create_if_missing(true);
|
||||
// Create column families if missing
|
||||
|
|
|
@ -55,3 +55,10 @@ pub static SPEEDB_MIN_BLOB_SIZE: Lazy<u64> = Lazy::new(|| {
|
|||
.map(|v| v.parse::<u64>().unwrap_or(default))
|
||||
.unwrap_or(default)
|
||||
});
|
||||
|
||||
pub static SPEEDB_KEEP_LOG_FILE_NUM: Lazy<usize> = Lazy::new(|| {
|
||||
let default = 20;
|
||||
std::env::var("SURREAL_SPEEDB_KEEP_LOG_FILE_NUM")
|
||||
.map(|v| v.parse::<usize>().unwrap_or(default))
|
||||
.unwrap_or(default)
|
||||
});
|
||||
|
|
|
@ -79,6 +79,8 @@ impl Datastore {
|
|||
opts.set_use_fsync(false);
|
||||
// Only use warning log level
|
||||
opts.set_log_level(LogLevel::Warn);
|
||||
// Set the number of log files to keep
|
||||
opts.set_keep_log_file_num(*cnf::SPEEDB_KEEP_LOG_FILE_NUM);
|
||||
// Create database if missing
|
||||
opts.create_if_missing(true);
|
||||
// Create column families if missing
|
||||
|
|
Loading…
Reference in a new issue