mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-08-24 03:48:08 +08:00
avoid nil
This commit is contained in:
parent
36f95e50a9
commit
a0c6db361c
@ -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 {
|
func (ecNode *EcNode) addEcVolumeShards(vid needle.VolumeId, collection string, shardIds []uint32) *EcNode {
|
||||||
|
|
||||||
foundVolume := false
|
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 {
|
for _, shardInfo := range diskInfo.EcShardInfos {
|
||||||
if needle.VolumeId(shardInfo.Id) == vid {
|
if needle.VolumeId(shardInfo.Id) == vid {
|
||||||
oldShardBits := erasure_coding.ShardBits(shardInfo.EcIndexBits)
|
oldShardBits := erasure_coding.ShardBits(shardInfo.EcIndexBits)
|
||||||
@ -316,6 +317,11 @@ func (ecNode *EcNode) addEcVolumeShards(vid needle.VolumeId, collection string,
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
diskInfo = &master_pb.DiskInfo{
|
||||||
|
Type: string(types.HardDriveType),
|
||||||
|
}
|
||||||
|
ecNode.info.DiskInfos[string(types.HardDriveType)] = diskInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
if !foundVolume {
|
if !foundVolume {
|
||||||
|
Loading…
Reference in New Issue
Block a user