diff --git a/weed/storage/store_ec.go b/weed/storage/store_ec.go index eb10e5ae1..5a718f316 100644 --- a/weed/storage/store_ec.go +++ b/weed/storage/store_ec.go @@ -87,7 +87,7 @@ func (s *Store) MountEcShards(collection string, vid needle.VolumeId, shardId er func (s *Store) UnmountEcShards(vid needle.VolumeId, shardId erasure_coding.ShardId, generation uint32) error { - diskId, ecShard, found := s.findEcShard(vid, shardId) + diskId, ecShard, found := s.findEcShardWithGeneration(vid, shardId, generation) if !found { return nil } @@ -122,6 +122,15 @@ func (s *Store) findEcShard(vid needle.VolumeId, shardId erasure_coding.ShardId) return 0, nil, false } +func (s *Store) findEcShardWithGeneration(vid needle.VolumeId, shardId erasure_coding.ShardId, generation uint32) (diskId uint32, shard *erasure_coding.EcVolumeShard, found bool) { + for diskId, location := range s.Locations { + if v, found := location.FindEcShardWithGeneration(vid, shardId, generation); found { + return uint32(diskId), v, found + } + } + return 0, nil, false +} + func (s *Store) FindEcVolume(vid needle.VolumeId) (*erasure_coding.EcVolume, bool) { for _, location := range s.Locations { if s, found := location.FindEcVolume(vid); found {