|
|
@ -22,7 +22,11 @@ func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServ |
|
|
|
|
|
|
|
defer func() { |
|
|
|
if dn != nil { |
|
|
|
|
|
|
|
dn.Counter-- |
|
|
|
if dn.Counter > 0 { |
|
|
|
glog.V(0).Infof("disconnect phantom volume server %s:%d remaining %d", dn.Counter, dn.Ip, dn.Port) |
|
|
|
return |
|
|
|
} |
|
|
|
// if the volume server disconnects and reconnects quickly
|
|
|
|
// the unregister and register can race with each other
|
|
|
|
ms.Topo.UnRegisterDataNode(dn) |
|
|
@ -68,6 +72,7 @@ func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServ |
|
|
|
dc := ms.Topo.GetOrCreateDataCenter(dcName) |
|
|
|
rack := dc.GetOrCreateRack(rackName) |
|
|
|
dn = rack.GetOrCreateDataNode(heartbeat.Ip, int(heartbeat.Port), heartbeat.PublicUrl, heartbeat.MaxVolumeCounts) |
|
|
|
dn.Counter++ |
|
|
|
glog.V(0).Infof("added volume server %v:%d", heartbeat.GetIp(), heartbeat.GetPort()) |
|
|
|
if err := stream.Send(&master_pb.HeartbeatResponse{ |
|
|
|
VolumeSizeLimit: uint64(ms.option.VolumeSizeLimitMB) * 1024 * 1024, |
|
|
|