add disable wal config for rocksdb

This commit is contained in:
siddontang 2014-10-24 23:30:27 +08:00
parent 3c38beb62d
commit 57d60b0ce0
4 changed files with 12 additions and 2 deletions

View File

@ -59,6 +59,7 @@ type RocksDBConfig struct {
StatsDumpPeriodSec int `toml:"stats_dump_period_sec"`
BackgroundThreads int `toml:"background_theads"`
HighPriorityBackgroundThreads int `toml:"high_priority_background_threads"`
DisableWAL bool `toml:"disable_wal"`
}
type LMDBConfig struct {
@ -169,6 +170,7 @@ func NewConfigDefault() *Config {
cfg.RocksDB.UseFsync = false
cfg.RocksDB.DisableAutoCompactions = false
cfg.RocksDB.AllowOsBuffer = true
cfg.RocksDB.DisableWAL = false
cfg.adjust()

View File

@ -82,7 +82,10 @@ max_background_flushes = 1
allow_os_buffer = true
enable_statistics = false
stats_dump_period_sec = 3600
# dangerous to set true, write may got lost after a crash
# you can set true if replication opened, we may recover from replication log,
# but it is still not a easy work.
disable_wal = false
[lmdb]
map_size = 524288000

View File

@ -82,7 +82,10 @@ max_background_flushes = 1
allow_os_buffer = true
enable_statistics = false
stats_dump_period_sec = 3600
# dangerous to set true, write may got lost after a crash
# you can set true if replication opened, we may recover from replication log,
# but it is still not a easy work.
disable_wal = false
[lmdb]
map_size = 524288000

View File

@ -150,9 +150,11 @@ func (db *DB) initOptions(cfg *config.RocksDBConfig) {
db.readOpts = NewReadOptions()
db.writeOpts = NewWriteOptions()
db.writeOpts.DisableWAL(cfg.DisableWAL)
db.syncOpts = NewWriteOptions()
db.syncOpts.SetSync(true)
db.syncOpts.DisableWAL(cfg.DisableWAL)
db.iteratorOpts = NewReadOptions()
db.iteratorOpts.SetFillCache(false)