Fix: Fail fast on unsupported volume versions (#8047)
* Fix: Fail fast when initializing volume with Version 0 * Fix: Fail fast when loading unsupported volume version (e.g. 0 or 4) * Refactor: Use IsSupportedVersion helper function for version validation
This commit is contained in:
@@ -106,6 +106,9 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
|
||||
if alreadyHasSuperBlock {
|
||||
err = v.readSuperBlock()
|
||||
if err == nil {
|
||||
if !needle.IsSupportedVersion(v.SuperBlock.Version) {
|
||||
glog.Fatalf("Unsupported volume %d version %v", v.Id, v.SuperBlock.Version)
|
||||
}
|
||||
v.volumeInfo.Version = uint32(v.SuperBlock.Version)
|
||||
}
|
||||
glog.V(2).Infof("readSuperBlock volume %d version %v", v.Id, v.SuperBlock.Version)
|
||||
|
||||
Reference in New Issue
Block a user