forked from mirror/ledisdb
add disable wal config for rocksdb
This commit is contained in:
parent
3c38beb62d
commit
57d60b0ce0
|
@ -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()
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue