add repair
This commit is contained in:
parent
4cf3fecc55
commit
bae35eafa7
@ -137,11 +137,20 @@ var (
|
|||||||
queryAddress = flag.String("address", "", "query contents of this address")
|
queryAddress = flag.String("address", "", "query contents of this address")
|
||||||
|
|
||||||
resync = flag.Bool("resync", false, "resync until tip")
|
resync = flag.Bool("resync", false, "resync until tip")
|
||||||
|
|
||||||
|
repair = flag.Bool("repair", false, "repair the database")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if *repair {
|
||||||
|
if err := RepairRocksDB(*dbPath); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
timeout := time.Duration(*rpcTimeout) * time.Second
|
timeout := time.Duration(*rpcTimeout) * time.Second
|
||||||
rpc := NewBitcoinRPC(*rpcURL, *rpcUser, *rpcPass, timeout)
|
rpc := NewBitcoinRPC(*rpcURL, *rpcUser, *rpcPass, timeout)
|
||||||
if *rpcCache > 0 {
|
if *rpcCache > 0 {
|
||||||
|
|||||||
@ -13,6 +13,12 @@ import (
|
|||||||
"github.com/tecbot/gorocksdb"
|
"github.com/tecbot/gorocksdb"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func RepairRocksDB(name string) error {
|
||||||
|
log.Printf("rocksdb: repair")
|
||||||
|
opts := gorocksdb.NewDefaultOptions()
|
||||||
|
return gorocksdb.RepairDb(name, opts)
|
||||||
|
}
|
||||||
|
|
||||||
type RocksDB struct {
|
type RocksDB struct {
|
||||||
db *gorocksdb.DB
|
db *gorocksdb.DB
|
||||||
wo *gorocksdb.WriteOptions
|
wo *gorocksdb.WriteOptions
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user