Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

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

Lisandro Pin9e15823855c7
diff --git a/weed/server/master_grpc_server.go b/weed/server/master_grpc_server.go
index 7c6bd1e3cf..d33782ae17 100644
--- a/weed/server/master_grpc_server.go
+++ b/weed/server/master_grpc_server.go
@@ -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(),
diff --git a/weed/topology/data_node.go b/weed/topology/data_node.go
index f4ad0220c3..11412195d7 100644
--- a/weed/topology/data_node.go
+++ b/weed/topology/data_node.go
@@ -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 {