mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
avoid possible nil
fix https://github.com/chrislusf/seaweedfs/issues/1928 The nil was because of `dn.Parent().UnlinkChildNode(dn.Id())` in topo.UnRegisterDataNode() function, when the dn leaves the cluster.
This commit is contained in:
parent
f315eb2bb8
commit
5d931eff27
|
@ -80,10 +80,14 @@ func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServ
|
||||||
dn.AdjustMaxVolumeCounts(heartbeat.MaxVolumeCounts)
|
dn.AdjustMaxVolumeCounts(heartbeat.MaxVolumeCounts)
|
||||||
|
|
||||||
glog.V(4).Infof("master received heartbeat %s", heartbeat.String())
|
glog.V(4).Infof("master received heartbeat %s", heartbeat.String())
|
||||||
|
var dataCenter string
|
||||||
|
if dc := dn.GetDataCenter(); dc != nil {
|
||||||
|
dataCenter = string(dc.Id())
|
||||||
|
}
|
||||||
message := &master_pb.VolumeLocation{
|
message := &master_pb.VolumeLocation{
|
||||||
Url: dn.Url(),
|
Url: dn.Url(),
|
||||||
PublicUrl: dn.PublicUrl,
|
PublicUrl: dn.PublicUrl,
|
||||||
DataCenter: string(dn.GetDataCenter().Id()),
|
DataCenter: dataCenter,
|
||||||
}
|
}
|
||||||
if len(heartbeat.NewVolumes) > 0 || len(heartbeat.DeletedVolumes) > 0 {
|
if len(heartbeat.NewVolumes) > 0 || len(heartbeat.DeletedVolumes) > 0 {
|
||||||
// process delta volume ids if exists for fast volume id updates
|
// process delta volume ids if exists for fast volume id updates
|
||||||
|
|
Loading…
Reference in a new issue