mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-27 20:59:42 +08:00
saving .vif files correctly
This commit is contained in:
parent
acf7ca7b93
commit
288baf37fd
@ -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
|
||||
|
@ -14,12 +14,11 @@ func (v *Volume) GetVolumeInfo() *volume_server_pb.VolumeInfo {
|
||||
|
||||
func (v *Volume) maybeLoadVolumeInfo() (found bool) {
|
||||
|
||||
v.volumeInfo, found = pb.MaybeLoadVolumeInfo(v.FileName() + ".vif")
|
||||
v.volumeInfo, v.hasRemoteFile = pb.MaybeLoadVolumeInfo(v.FileName() + ".vif")
|
||||
|
||||
if found {
|
||||
if v.hasRemoteFile {
|
||||
glog.V(0).Infof("volume %d is tiered to %s as %s and read only", v.Id,
|
||||
v.volumeInfo.Files[0].BackendName(), v.volumeInfo.Files[0].Key)
|
||||
v.hasRemoteFile = true
|
||||
}
|
||||
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user