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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
Fix a race condition when handle VolumeLocationList
LIBA-Seecd6b5d35f0
diff --git a/weed/topology/topology_vacuum.go b/weed/topology/topology_vacuum.goindex 789a013300..1079816fc9 100644--- a/weed/topology/topology_vacuum.go+++ b/weed/topology/topology_vacuum.go@@ -165,7 +165,7 @@ func vacuumOneVolumeLayout(grpcDialOption grpc.DialOption, volumeLayout *VolumeLvolumeLayout.accessLock.RLock()tmpMap := make(map[needle.VolumeId]*VolumeLocationList)for vid, locationList := range volumeLayout.vid2location {- tmpMap[vid] = locationList+ tmpMap[vid] = locationList.Copy()}volumeLayout.accessLock.RUnlock()diff --git a/weed/topology/volume_location_list.go b/weed/topology/volume_location_list.goindex 8905c54b5f..6acd70f2f5 100644--- a/weed/topology/volume_location_list.go+++ b/weed/topology/volume_location_list.go@@ -18,6 +18,14 @@ func (dnll *VolumeLocationList) String() string {return fmt.Sprintf("%v", dnll.list)}+func (dnll *VolumeLocationList) Copy() *VolumeLocationList {+ list := make([]*DataNode, len(dnll.list))+ copy(list, dnll.list)+ return &VolumeLocationList{+ list: list,+ }+}+func (dnll *VolumeLocationList) Head() *DataNode {//mark first node as master volumereturn dnll.list[0]