Browse Source

leveldb recover error handling

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

6
weed/filer2/leveldb/leveldb_store.go

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

4
weed/storage/needle_map_leveldb.go

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

Loading…
Cancel
Save