diff --git a/weed/server/master_grpc_server.go b/weed/server/master_grpc_server.go index 74d347142e6..35bfdefedfc 100644 --- a/weed/server/master_grpc_server.go +++ b/weed/server/master_grpc_server.go @@ -126,6 +126,10 @@ func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServ ms.Topo.Sequence.SetMax(heartbeat.MaxFileKey) if dn == nil { + // skip deltaBeat + if heartbeat.HasNoVolumes { + continue + } dcName, rackName := ms.Topo.Configuration.Locate(heartbeat.Ip, heartbeat.DataCenter, heartbeat.Rack) dc := ms.Topo.GetOrCreateDataCenter(dcName) rack := dc.GetOrCreateRack(rackName) diff --git a/weed/topology/configuration.go b/weed/topology/configuration.go index cb635658f0e..d9fde4a047d 100644 --- a/weed/topology/configuration.go +++ b/weed/topology/configuration.go @@ -20,9 +20,8 @@ type topology struct { DataCenters []dataCenter `xml:"DataCenter"` } type Configuration struct { - XMLName xml.Name `xml:"Configuration"` - Topo topology `xml:"Topology"` - ip2location map[string]loc // this is not used any more. leave it here for later. + XMLName xml.Name `xml:"Configuration"` + Topo topology `xml:"Topology"` } func (c *Configuration) String() string { @@ -33,12 +32,6 @@ func (c *Configuration) String() string { } func (c *Configuration) Locate(ip string, dcName string, rackName string) (dc string, rack string) { - if c != nil && c.ip2location != nil { - if loc, ok := c.ip2location[ip]; ok { - return loc.dcName, loc.rackName - } - } - if dcName == "" { dcName = "DefaultDataCenter" } diff --git a/weed/wdclient/masterclient.go b/weed/wdclient/masterclient.go index 41c5a8bc45b..d3bdf202f92 100644 --- a/weed/wdclient/masterclient.go +++ b/weed/wdclient/masterclient.go @@ -262,12 +262,17 @@ func (mc *MasterClient) tryConnectToMaster(master pb.ServerAddress) (nextHintedL } func (mc *MasterClient) updateVidMap(resp *master_pb.KeepConnectedResponse) { + volLocGrpcPort := int(resp.VolumeLocation.GrpcPort) + if resp.VolumeLocation.Url == "" || volLocGrpcPort == 0 { + glog.V(0).Infof("updateVidMap ignore short heartbeat: %+v", resp) + return + } // process new volume location loc := Location{ Url: resp.VolumeLocation.Url, PublicUrl: resp.VolumeLocation.PublicUrl, DataCenter: resp.VolumeLocation.DataCenter, - GrpcPort: int(resp.VolumeLocation.GrpcPort), + GrpcPort: volLocGrpcPort, } for _, newVid := range resp.VolumeLocation.NewVids { glog.V(2).Infof("%s.%s: %s masterClient adds volume %d", mc.FilerGroup, mc.clientType, loc.Url, newVid)