Browse Source

leveldb recover error handling

pull/1341/head
Chris Lu 5 years ago
parent
commit
ef2b3a0801
  1. 2
      weed/filer2/leveldb/leveldb_store.go
  2. 2
      weed/storage/needle_map_leveldb.go

2
weed/filer2/leveldb/leveldb_store.go

@ -53,9 +53,11 @@ func (store *LevelDBStore) initialize(dir string) (err error) {
if errors.IsCorrupted(err) {
store.db, err = leveldb.RecoverFile(dir, opts)
}
if err != nil {
glog.Infof("filer store open dir %s: %v", dir, err)
return
}
}
return
}

2
weed/storage/needle_map_leveldb.go

@ -38,8 +38,10 @@ func NewLevelDbNeedleMap(dbFileName string, indexFile *os.File, opts *opt.Option
if errors.IsCorrupted(err) {
m.db, err = leveldb.RecoverFile(dbFileName, opts)
}
if err != nil {
return
}
}
glog.V(1).Infof("Loading %s...", indexFile.Name())
mm, indexLoadError := newNeedleMapMetricFromIndexFile(indexFile)
if indexLoadError != nil {

Loading…
Cancel
Save