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
Don't return actual file size from CheckVolumeDataIntegrity, it will be 0 if last needle is a tombstone, so it's not reliable anyway
brstgt0656838fe576
diff --git a/weed/storage/volume_checking.go b/weed/storage/volume_checking.goindex 6d4011f273..67538ebb2d 100644--- a/weed/storage/volume_checking.go+++ b/weed/storage/volume_checking.go@@ -12,28 +12,28 @@ func getActualSize(size uint32) int64 {return NeedleHeaderSize + int64(size) + NeedleChecksumSize + int64(padding)}-func CheckVolumeDataIntegrity(v *Volume, indexFile *os.File) (int64, error) {+func CheckVolumeDataIntegrity(v *Volume, indexFile *os.File) (error) {var indexSize int64var e errorif indexSize, e = verifyIndexFileIntegrity(indexFile); e != nil {- return 0, fmt.Errorf("verifyIndexFileIntegrity %s failed: %v", indexFile.Name(), e)+ return fmt.Errorf("verifyIndexFileIntegrity %s failed: %v", indexFile.Name(), e)}if indexSize == 0 {- return int64(SuperBlockSize), nil+ return nil}var lastIdxEntry []byteif lastIdxEntry, e = readIndexEntryAtOffset(indexFile, indexSize-NeedleIndexSize); e != nil {- return 0, fmt.Errorf("readLastIndexEntry %s failed: %v", indexFile.Name(), e)+ return fmt.Errorf("readLastIndexEntry %s failed: %v", indexFile.Name(), e)}key, offset, size := idxFileEntry(lastIdxEntry)if offset == 0 || size == TombstoneFileSize {- return 0, nil+ return nil}if e = verifyNeedleIntegrity(v.dataFile, v.Version(), int64(offset)*NeedlePaddingSize, key, size); e != nil {- return 0, fmt.Errorf("verifyNeedleIntegrity %s failed: %v", indexFile.Name(), e)+ return fmt.Errorf("verifyNeedleIntegrity %s failed: %v", indexFile.Name(), e)}- return int64(offset)*int64(NeedlePaddingSize) + getActualSize(size), nil+ return nil}func verifyIndexFileIntegrity(indexFile *os.File) (indexSize int64, err error) {diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.goindex 5043c1754e..4be8609870 100644--- a/weed/storage/volume_loading.go+++ b/weed/storage/volume_loading.go@@ -64,7 +64,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKindreturn fmt.Errorf("cannot write Volume Index %s.idx: %v", fileName, e)}}- if _, e = CheckVolumeDataIntegrity(v, indexFile); e != nil {+ if e = CheckVolumeDataIntegrity(v, indexFile); e != nil {v.readOnly = trueglog.V(0).Infof("volumeDataIntegrityChecking failed %v", e)}