volume: fail fast if idx files are missing

fix https://github.com/chrislusf/seaweedfs/issues/1796
This commit is contained in:
Chris Lu
2021-02-11 00:44:40 -08:00
parent a0e84c4fbc
commit 885ca34748
2 changed files with 20 additions and 0 deletions

View File

@@ -96,6 +96,10 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
v.dirIdx = v.dir
}
}
// check volume idx files
if err := v.checkIdxFile(); err != nil {
glog.Fatalf("check volume idx file %s: %v", v.FileName(".idx"), err)
}
var indexFile *os.File
if v.noWriteOrDelete {
glog.V(0).Infoln("open to read file", v.FileName(".idx"))