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
ensure unwritable volumes are not in writables list
Chris Lua74978baebb6
diff --git a/go/topology/volume_layout.go b/go/topology/volume_layout.goindex a0451cc004..678035f524 100644--- a/go/topology/volume_layout.go+++ b/go/topology/volume_layout.go@@ -1,9 +1,9 @@package topologyimport (+ "code.google.com/p/weed-fs/go/glog""code.google.com/p/weed-fs/go/storage""errors"- "code.google.com/p/weed-fs/go/glog""math/rand""sync")@@ -38,6 +38,8 @@ func (vl *VolumeLayout) RegisterVolume(v *storage.VolumeInfo, dn *DataNode) {if len(vl.vid2location[v.Id].list) == v.RepType.GetCopyCount() {if vl.isWritable(v) {vl.writables = append(vl.writables, v.Id)+ } else {+ vl.removeFromWritable(v.Id)}}}@@ -105,13 +107,18 @@ func (vl *VolumeLayout) GetActiveVolumeCount(dataCenter string) int {}func (vl *VolumeLayout) removeFromWritable(vid storage.VolumeId) bool {- for i, v := range vl.writables {- if v == vid {- glog.V(0).Infoln("Volume", vid, "becomes unwritable")- vl.writables = append(vl.writables[:i], vl.writables[i+1:]...)- return true+ toDeleteIndex := -1+ for k, id := range vl.writables {+ if id == vid {+ toDeleteIndex = k+ break}}+ if toDeleteIndex >= 0 {+ glog.V(0).Infoln("Volume", vid, "becomes unwritable")+ vl.writables = append(vl.writables[0:toDeleteIndex], vl.writables[toDeleteIndex+1:]...)+ return true+ }return false}func (vl *VolumeLayout) setVolumeWritable(vid storage.VolumeId) bool {