Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

avoid nil

Chris Lua0c6db361c7f
diff --git a/weed/shell/command_ec_common.go b/weed/shell/command_ec_common.go
index c3ffa67d67..87a138ab6c 100644
--- a/weed/shell/command_ec_common.go
+++ b/weed/shell/command_ec_common.go
@@ -302,7 +302,8 @@ func findEcVolumeShards(ecNode *EcNode, vid needle.VolumeId) erasure_coding.Shar
func (ecNode *EcNode) addEcVolumeShards(vid needle.VolumeId, collection string, shardIds []uint32) *EcNode {
foundVolume := false
- if diskInfo, found := ecNode.info.DiskInfos[string(types.HardDriveType)]; found {
+ diskInfo, found := ecNode.info.DiskInfos[string(types.HardDriveType)]
+ if found {
for _, shardInfo := range diskInfo.EcShardInfos {
if needle.VolumeId(shardInfo.Id) == vid {
oldShardBits := erasure_coding.ShardBits(shardInfo.EcIndexBits)
@@ -316,6 +317,11 @@ func (ecNode *EcNode) addEcVolumeShards(vid needle.VolumeId, collection string,
break
}
}
+ } else {
+ diskInfo = &master_pb.DiskInfo{
+ Type: string(types.HardDriveType),
+ }
+ ecNode.info.DiskInfos[string(types.HardDriveType)] = diskInfo
}
if !foundVolume {