diff options
| author | chrislu <chris.lu@gmail.com> | 2023-04-17 22:56:21 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2023-04-17 22:56:21 -0700 |
| commit | 0a22eea55df8462d8fdfc206f4995304ddaca5d9 (patch) | |
| tree | 6ddf9797c1e817e62522e69d4f149cae36e3e8ad /weed/storage/disk_location_ec.go | |
| parent | d50d736e68feb8896b7d3776ffe000fe2ebd2e7c (diff) | |
| download | seaweedfs-0a22eea55df8462d8fdfc206f4995304ddaca5d9.tar.xz seaweedfs-0a22eea55df8462d8fdfc206f4995304ddaca5d9.zip | |
collect ec shard from multiple locations
fix https://github.com/seaweedfs/seaweedfs/issues/4365
Diffstat (limited to 'weed/storage/disk_location_ec.go')
| -rw-r--r-- | weed/storage/disk_location_ec.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go index ee21eb803..5af354277 100644 --- a/weed/storage/disk_location_ec.go +++ b/weed/storage/disk_location_ec.go @@ -38,6 +38,22 @@ func (l *DiskLocation) DestroyEcVolume(vid needle.VolumeId) { } } +func (l *DiskLocation) CollectEcShards(vid needle.VolumeId, shardFileNames []string) (ecVolume *erasure_coding.EcVolume, found bool) { + l.ecVolumesLock.RLock() + defer l.ecVolumesLock.RUnlock() + + ecVolume, found = l.ecVolumes[vid] + if !found { + return + } + for _, ecShard := range ecVolume.Shards { + if ecShard.ShardId < erasure_coding.ShardId(len(shardFileNames)) { + shardFileNames[ecShard.ShardId] = erasure_coding.EcShardFileName(ecVolume.Collection, l.Directory, int(ecVolume.VolumeId)) + erasure_coding.ToExt(int(ecShard.ShardId)) + } + } + return +} + func (l *DiskLocation) FindEcShard(vid needle.VolumeId, shardId erasure_coding.ShardId) (*erasure_coding.EcVolumeShard, bool) { l.ecVolumesLock.RLock() defer l.ecVolumesLock.RUnlock() |
