Have masters update DataNode details based on state heartbeats from volume servers. (#8017)

This commit is contained in:
Lisandro Pin
2026-01-30 06:51:46 +01:00
committed by GitHub
parent 6940b7d06e
commit 9e15823855
2 changed files with 18 additions and 1 deletions

View File

@@ -165,7 +165,22 @@ func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServ
glog.V(4).Infof("master received heartbeat %s", heartbeat.String())
stats.MasterReceivedHeartbeatCounter.WithLabelValues("total").Inc()
// TODO(issues/7977): process status heartbeat updates from volume servers
if heartbeat.State != nil {
stats.MasterReceivedHeartbeatCounter.WithLabelValues("stateUpdates").Inc()
updated := false
dn.Lock()
if dn.MaintenanceMode != heartbeat.State.GetMaintenance() {
updated = true
dn.MaintenanceMode = heartbeat.State.GetMaintenance()
}
dn.Unlock()
if updated {
glog.V(1).Infof("master sees state update from %s: %v", dn.Url(), heartbeat.State)
}
}
message := &master_pb.VolumeLocation{
Url: dn.Url(),

View File

@@ -23,6 +23,8 @@ type DataNode struct {
LastSeen int64 // unix time in seconds
Counter int // in race condition, the previous dataNode was not dead
IsTerminating bool
MaintenanceMode bool
}
func NewDataNode(id string) *DataNode {