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
erasure coding: fix cases where there are no .ecj files
Chris Luae1994cbc169
diff --git a/weed/server/volume_grpc_erasure_coding.go b/weed/server/volume_grpc_erasure_coding.goindex 66dd5bf8df..3d11cff29d 100644--- a/weed/server/volume_grpc_erasure_coding.go+++ b/weed/server/volume_grpc_erasure_coding.go@@ -201,9 +201,7 @@ func (vs *VolumeServer) VolumeEcShardsDelete(ctx context.Context, req *volume_seif err := os.Remove(baseFilename + ".ecx"); err != nil {return nil, err}- if err := os.Remove(baseFilename + ".ecj"); err != nil {- return nil, err- }+ os.Remove(baseFilename + ".ecj")}if !hasIdxFile {// .vif is used for ec volumes and normal volumesdiff --git a/weed/shell/command_ec_encode.go b/weed/shell/command_ec_encode.goindex 165809d05d..5a8146954d 100644--- a/weed/shell/command_ec_encode.go+++ b/weed/shell/command_ec_encode.go@@ -123,6 +123,8 @@ func markVolumeReadonly(grpcDialOption grpc.DialOption, volumeId needle.VolumeIdfor _, location := range locations {+ fmt.Printf("markVolumeReadonly %d on %s ...\n", volumeId, location.Url)+err := operation.WithVolumeServerClient(location.Url, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, markErr := volumeServerClient.VolumeMarkReadonly(context.Background(), &volume_server_pb.VolumeMarkReadonlyRequest{VolumeId: uint32(volumeId),@@ -141,6 +143,8 @@ func markVolumeReadonly(grpcDialOption grpc.DialOption, volumeId needle.VolumeIdfunc generateEcShards(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, collection string, sourceVolumeServer string) error {+ fmt.Printf("generateEcShards %s %d on %s ...\n", collection, volumeId, sourceVolumeServer)+err := operation.WithVolumeServerClient(sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, genErr := volumeServerClient.VolumeEcShardsGenerate(context.Background(), &volume_server_pb.VolumeEcShardsGenerateRequest{VolumeId: uint32(volumeId),@@ -204,6 +208,8 @@ func spreadEcShards(commandEnv *CommandEnv, volumeId needle.VolumeId, collectionfunc parallelCopyEcShardsFromSource(grpcDialOption grpc.DialOption, targetServers []*EcNode, allocatedEcIds [][]uint32, volumeId needle.VolumeId, collection string, existingLocation wdclient.Location) (actuallyCopied []uint32, err error) {+ fmt.Printf("parallelCopyEcShardsFromSource %d %s\n", volumeId, existingLocation.Url)+// parallelizeshardIdChan := make(chan []uint32, len(targetServers))var wg sync.WaitGroupdiff --git a/weed/shell/command_volume_fix_replication.go b/weed/shell/command_volume_fix_replication.goindex 19da89b676..6b5e4e7358 100644--- a/weed/shell/command_volume_fix_replication.go+++ b/weed/shell/command_volume_fix_replication.go@@ -121,7 +121,10 @@ func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv,VolumeId: volumeInfo.Id,SourceDataNode: sourceNode.dataNode.Id,})- return fmt.Errorf("copying from %s => %s : %v", sourceNode.dataNode.Id, dst.dataNode.Id, replicateErr)+ if replicateErr != nil {+ return fmt.Errorf("copying from %s => %s : %v", sourceNode.dataNode.Id, dst.dataNode.Id, replicateErr)+ }+ return nil})if err != nil {diff --git a/weed/storage/erasure_coding/ec_decoder.go b/weed/storage/erasure_coding/ec_decoder.goindex ae77cee3fe..7b42d02e7f 100644--- a/weed/storage/erasure_coding/ec_decoder.go+++ b/weed/storage/erasure_coding/ec_decoder.go@@ -11,6 +11,7 @@ import ("github.com/chrislusf/seaweedfs/weed/storage/needle_map""github.com/chrislusf/seaweedfs/weed/storage/super_block""github.com/chrislusf/seaweedfs/weed/storage/types"+ "github.com/chrislusf/seaweedfs/weed/util")// write .idx file from .ecx and .ecj files@@ -118,9 +119,12 @@ func iterateEcxFile(baseFileName string, processNeedleFn func(key types.NeedleId}func iterateEcjFile(baseFileName string, processNeedleFn func(key types.NeedleId) error) error {+ if !util.FileExists(baseFileName+".ecj") {+ return nil+ }ecjFile, openErr := os.OpenFile(baseFileName+".ecj", os.O_RDONLY, 0644)if openErr != nil {- return fmt.Errorf("cannot open ec index %s.ecx: %v", baseFileName, openErr)+ return fmt.Errorf("cannot open ec index %s.ecj: %v", baseFileName, openErr)}defer ecjFile.Close()