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: return error if superblock is not initialized
Chris Lu09874f0d16f6
diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.goindex 0b6021ca8a..19a45c8425 100644--- a/weed/storage/volume_loading.go+++ b/weed/storage/volume_loading.go@@ -59,6 +59,9 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKindif alreadyHasSuperBlock {e = v.readSuperBlock()} else {+ if !v.SuperBlock.Initialized() {+ return fmt.Errorf("volume %s.dat not initialized", fileName)+ }e = v.maybeWriteSuperBlock()}if e == nil && alsoLoadIndex {diff --git a/weed/storage/volume_super_block.go b/weed/storage/volume_super_block.goindex 164c887e14..d0f2757faa 100644--- a/weed/storage/volume_super_block.go+++ b/weed/storage/volume_super_block.go@@ -69,6 +69,10 @@ func (s *SuperBlock) Bytes() []byte {return header}+func (s *SuperBlock) Initialized() bool {+ return s.ReplicaPlacement == nil || s.Ttl == nil+}+func (v *Volume) maybeWriteSuperBlock() error {stat, e := v.dataFile.Stat()if e != nil {