Skip to content

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.

Fix superblock write error checks on volume compaction. (#8352)

Lisandro Pin11fdb6828136
diff --git a/weed/storage/volume_vacuum.go b/weed/storage/volume_vacuum.go
index 4cc3911a5b..2c20ce634a 100644
--- a/weed/storage/volume_vacuum.go
+++ b/weed/storage/volume_vacuum.go
@@ -484,8 +484,10 @@ func (v *Volume) copyDataBasedOnIndexFile(opts *CompactOptions) (err error) {
now := uint64(time.Now().Unix())
opts.superBlock.CompactionRevision++
- dstDatBackend.WriteAt(opts.superBlock.Bytes(), 0)
newOffset := int64(opts.superBlock.BlockSize())
+ if _, err := dstDatBackend.WriteAt(opts.superBlock.Bytes(), 0); err != nil {
+ return fmt.Errorf("failed to write superblock: %v", err)
+ }
writeThrottler := util.NewWriteThrottler(opts.MaxBytesPerSecond)
err = oldNm.AscendingVisit(func(value needle_map.NeedleValue) error {