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
Make shell command `ec.scrub` return shard details upon scrub failures in `LOCAL` mode. (#9913)
Lisandro Pin5150c8693411
diff --git a/weed/storage/erasure_coding/ec_volume_scrub.go b/weed/storage/erasure_coding/ec_volume_scrub.goindex aa759058b3..208aeb78f7 100644--- a/weed/storage/erasure_coding/ec_volume_scrub.go+++ b/weed/storage/erasure_coding/ec_volume_scrub.go@@ -234,17 +234,21 @@ func (ecv *EcVolume) ScrubLocal() (int64, []*volume_server_pb.EcShardInfo, []errvar data []bytelocations := ecv.LocateEcShardNeedleInterval(ecv.Version, offset.ToActualOffset(), size)+ localShardIds := []ShardId{}for i, iv := range locations {sid, soffset := iv.ToShardIdAndOffset(ErasureCodingLargeBlockSize, ErasureCodingSmallBlockSize)ssize := int64(iv.Size.Raw())shard, found := ecv.FindEcVolumeShard(sid)+if !found {// shard is not local :( skip ithasRemoteChunks = trueread += ssizecontinue}+ localShardIds = append(localShardIds, sid)+if soffset+int64(ssize) > shard.Size() {flagShardBroken(shard, "local shard %d for needle %d is too short (%d), cannot read chunk %d/%d", sid, id, shard.Size(), i+1, len(locations))continue@@ -267,14 +271,16 @@ func (ecv *EcVolume) ScrubLocal() (int64, []*volume_server_pb.EcShardInfo, []errread += int64(got)}+ slices.Sort(localShardIds)+if got, want := read, needle.GetActualSize(size, ecv.Version); got != want {- return fmt.Errorf("expected %d bytes for needle %d, got %d", want, id, got)+ return fmt.Errorf("expected %d bytes for needle %d on volume %d, got %d", want, id, ecv.VolumeId, got)}if !hasRemoteChunks {// needle was fully recovered from local shards \o/ let's check itn := needle.Needle{}if err := n.ReadBytes(data, 0, size, ecv.Version); err != nil {- errs = append(errs, fmt.Errorf("needle %d on volume %d: %v", id, ecv.VolumeId, err))+ errs = append(errs, fmt.Errorf("needle %d on volume %d, shards %v: %v", id, ecv.VolumeId, localShardIds, err))}}