mirror of https://github.com/ledisdb/ledisdb.git
fix ledis-repair config error
This commit is contained in:
parent
7a763da082
commit
80689cb3fd
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
|
"github.com/siddontang/copier"
|
||||||
"github.com/siddontang/ledisdb/ledis"
|
"github.com/siddontang/ledisdb/ledis"
|
||||||
"github.com/siddontang/ledisdb/leveldb"
|
"github.com/siddontang/ledisdb/leveldb"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -36,11 +37,13 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(cfg.DataDB.Path) == 0 {
|
dbPath := path.Join(cfg.DataDir, "data")
|
||||||
cfg.DataDB.Path = path.Join(cfg.DataDir, "data")
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = leveldb.Repair(&cfg.DataDB); err != nil {
|
dbCfg := new(leveldb.Config)
|
||||||
|
copier.Copy(dbCfg, &cfg.DB)
|
||||||
|
dbCfg.Path = dbPath
|
||||||
|
|
||||||
|
if err = leveldb.Repair(dbCfg); err != nil {
|
||||||
println("repair error: ", err.Error())
|
println("repair error: ", err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue