diff --git a/config/config.go b/config/config.go index 612c33c..620c2ae 100644 --- a/config/config.go +++ b/config/config.go @@ -8,6 +8,7 @@ import ( "sync" "fmt" + "github.com/pelletier/go-toml" "github.com/siddontang/go/ioutil2" ) @@ -61,6 +62,7 @@ type RocksDBConfig struct { BackgroundThreads int `toml:"background_theads"` HighPriorityBackgroundThreads int `toml:"high_priority_background_threads"` DisableWAL bool `toml:"disable_wal"` + MaxManifestFileSize int `toml:"max_manifest_file_size"` } type LMDBConfig struct { @@ -264,6 +266,7 @@ func (cfg *RocksDBConfig) adjust() { cfg.StatsDumpPeriodSec = getDefault(3600, cfg.StatsDumpPeriodSec) cfg.BackgroundThreads = getDefault(2, cfg.BackgroundThreads) cfg.HighPriorityBackgroundThreads = getDefault(1, cfg.HighPriorityBackgroundThreads) + cfg.MaxManifestFileSize = getDefault(20*MB, cfg.MaxManifestFileSize) } func (cfg *Config) Dump(w io.Writer) error { diff --git a/config/config.toml b/config/config.toml index 8100ab1..86d51e1 100644 --- a/config/config.toml +++ b/config/config.toml @@ -106,6 +106,7 @@ stats_dump_period_sec = 3600 # you can set true if replication opened, we may recover from replication log, # but it is still not a easy work. disable_wal = false +max_manifest_file_size = 20971520 [lmdb] map_size = 524288000 diff --git a/store/rocksdb/db.go b/store/rocksdb/db.go index 5478831..d5b7080 100644 --- a/store/rocksdb/db.go +++ b/store/rocksdb/db.go @@ -145,6 +145,7 @@ func (db *DB) initOptions(cfg *config.RocksDBConfig) { opts.EnableStatistics(cfg.EnableStatistics) opts.UseFsync(cfg.UseFsync) opts.SetStatsDumpPeriodSec(cfg.StatsDumpPeriodSec) + opts.SetMaxManifestFileSize(cfg.MaxManifestFileSize) db.opts = opts db.blockOpts = blockOpts diff --git a/store/rocksdb/options.go b/store/rocksdb/options.go index aeb4a1f..48ca230 100644 --- a/store/rocksdb/options.go +++ b/store/rocksdb/options.go @@ -168,6 +168,10 @@ func (o *Options) SetStatsDumpPeriodSec(n int) { C.rocksdb_options_set_stats_dump_period_sec(o.Opt, C.uint(n)) } +func (o *Options) SetMaxManifestFileSize(n int) { + C.rocksdb_options_set_max_manifest_file_size(o.Opt, C.size_t(n)) +} + func (o *BlockBasedTableOptions) Close() { C.rocksdb_block_based_options_destroy(o.Opt) }