2020-05-09 16:30:50 +03:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
|
2023-02-15 10:41:45 +03:00
|
|
|
"git.internal/re/ledisdb/config"
|
|
|
|
"git.internal/re/ledisdb/store"
|
2020-05-09 16:30:50 +03:00
|
|
|
)
|
|
|
|
|
2020-05-10 13:17:39 +03:00
|
|
|
func Repair() {
|
2020-05-09 16:30:50 +03:00
|
|
|
var fileName = flag.String("config", "", "ledisdb config file")
|
|
|
|
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
if len(*fileName) == 0 {
|
|
|
|
println("need ledis config file")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
cfg, err := config.NewConfigWithFile(*fileName)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
println(err.Error())
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(cfg.DataDir) == 0 {
|
|
|
|
println("must set data dir")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if err = store.Repair(cfg); err != nil {
|
|
|
|
println("repair error: ", err.Error())
|
|
|
|
}
|
|
|
|
}
|