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
volume: ensure the volume dat and idx files are always closed
Chris Lud171d9f98813
diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.goindex fe4980e31f..34eee876d4 100644--- a/weed/storage/volume_loading.go+++ b/weed/storage/volume_loading.go@@ -25,6 +25,20 @@ func loadVolumeWithoutIndex(dirname string, collection string, id needle.VolumeIfunc (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind NeedleMapType, preallocate int64) (err error) {alreadyHasSuperBlock := false+ hasLoadedVolume := false+ defer func() {+ if !hasLoadedVolume {+ if v.nm != nil {+ v.nm.Close()+ v.nm = nil+ }+ if v.DataBackend != nil {+ v.DataBackend.Close()+ v.DataBackend = nil+ }+ }+ }()+hasVolumeInfoFile := v.maybeLoadVolumeInfo() && v.volumeInfo.Version != 0if v.HasRemoteFile() {@@ -151,5 +165,9 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKindstats.VolumeServerVolumeCounter.WithLabelValues(v.Collection, "volume").Inc()+ if err == nil {+ hasLoadedVolume = true+ }+return err}