Skip to content

Commit

Permalink
skip deltaBeat
Browse files Browse the repository at this point in the history
  • Loading branch information
kmlebedev committed Sep 8, 2022
1 parent 31d2f77 commit a476b6b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
4 changes: 4 additions & 0 deletions weed/server/master_grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 2 additions & 9 deletions weed/topology/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"
}
Expand Down
7 changes: 6 additions & 1 deletion weed/wdclient/masterclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a476b6b

Please sign in to comment.