saving .vif files correctly

This commit is contained in:
Chris Lu
2020-01-08 09:45:26 -08:00
parent acf7ca7b93
commit 288baf37fd
2 changed files with 8 additions and 6 deletions

View File

@@ -26,9 +26,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
fileName := v.FileName()
alreadyHasSuperBlock := false
if !v.maybeLoadVolumeInfo() {
v.SaveVolumeInfo()
}
hasVolumeInfoFile := v.maybeLoadVolumeInfo() && v.volumeInfo.Version != 0
if v.HasRemoteFile() {
v.noWriteCanDelete = true
@@ -141,6 +139,11 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
}
}
if !hasVolumeInfoFile {
v.volumeInfo.Version = uint32(v.SuperBlock.Version)
v.SaveVolumeInfo()
}
stats.VolumeServerVolumeCounter.WithLabelValues(v.Collection, "volume").Inc()
return err