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 "weed backup" rerunning
Chris Lu9b3bf0e46c65
diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.goindex 5722206507..37a6e07b29 100644--- a/weed/storage/volume_loading.go+++ b/weed/storage/volume_loading.go@@ -19,8 +19,9 @@ func loadVolumeWithoutIndex(dirname string, collection string, id VolumeId, needfunc (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind NeedleMapType, preallocate int64) error {var e errorfileName := v.FileName()+ alreadyHasSuperBlock := false- if exists, canRead, canWrite, modifiedTime := checkFile(fileName + ".dat"); exists {+ if exists, canRead, canWrite, modifiedTime, fileSize := checkFile(fileName + ".dat"); exists {if !canRead {return fmt.Errorf("cannot read Volume Data file %s.dat", fileName)}@@ -32,6 +33,9 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKindv.dataFile, e = os.Open(fileName + ".dat")v.readOnly = true}+ if fileSize >= _SuperBlockSize {+ alreadyHasSuperBlock = true+ }} else {if createDatIfMissing {v.dataFile, e = createVolumeFile(fileName+".dat", preallocate)@@ -48,7 +52,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind}}- if v.ReplicaPlacement == nil {+ if alreadyHasSuperBlock {e = v.readSuperBlock()} else {e = v.maybeWriteSuperBlock()@@ -97,7 +101,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKindreturn e}-func checkFile(filename string) (exists, canRead, canWrite bool, modTime time.Time) {+func checkFile(filename string) (exists, canRead, canWrite bool, modTime time.Time, fileSize int64) {exists = truefi, err := os.Stat(filename)if os.IsNotExist(err) {@@ -111,5 +115,6 @@ func checkFile(filename string) (exists, canRead, canWrite bool, modTime time.TicanWrite = true}modTime = fi.ModTime()+ fileSize = fi.Size()return}