volume: return error if superblock is not initialized

fix https://github.com/chrislusf/seaweedfs/issues/1079
This commit is contained in:
Chris Lu
2019-10-09 00:02:50 -07:00
parent a999ed94d0
commit 09874f0d16
2 changed files with 7 additions and 0 deletions

View File

@@ -59,6 +59,9 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
if alreadyHasSuperBlock {
e = v.readSuperBlock()
} else {
if !v.SuperBlock.Initialized() {
return fmt.Errorf("volume %s.dat not initialized", fileName)
}
e = v.maybeWriteSuperBlock()
}
if e == nil && alsoLoadIndex {