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.

avoid possible nil when node is disconnected from its parent

Chris Lu87a32bfef4f9
diff --git a/weed/topology/data_node.go b/weed/topology/data_node.go
index 69f739dd50..2813f7b451 100644
--- a/weed/topology/data_node.go
+++ b/weed/topology/data_node.go
@@ -177,7 +177,13 @@ func (dn *DataNode) GetVolumesById(id needle.VolumeId) (vInfo storage.VolumeInfo
func (dn *DataNode) GetDataCenter() *DataCenter {
rack := dn.Parent()
+ if rack == nil {
+ return nil
+ }
dcNode := rack.Parent()
+ if dcNode == nil {
+ return nil
+ }
dcValue := dcNode.GetValue()
return dcValue.(*DataCenter)
}