aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume_info/volume_info.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/storage/volume_info/volume_info.go')
-rw-r--r--weed/storage/volume_info/volume_info.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/weed/storage/volume_info/volume_info.go b/weed/storage/volume_info/volume_info.go
index 2ac4cc493..75cbc1472 100644
--- a/weed/storage/volume_info/volume_info.go
+++ b/weed/storage/volume_info/volume_info.go
@@ -42,6 +42,14 @@ func MaybeLoadVolumeInfo(fileName string) (volumeInfo *volume_server_pb.VolumeIn
}
+ // Handle empty .vif files gracefully - treat as if file doesn't exist
+ // This can happen when ec.decode copies from a source that doesn't have a .vif file
+ if len(fileData) == 0 {
+ glog.Warningf("empty volume info file %s, treating as non-existent", fileName)
+ hasVolumeInfoFile = false
+ return
+ }
+
glog.V(1).Infof("maybeLoadVolumeInfo Unmarshal volume info %v", fileName)
if err = jsonpb.Unmarshal(fileData, volumeInfo); err != nil {
if oldVersionErr := tryOldVersionVolumeInfo(fileData, volumeInfo); oldVersionErr != nil {