diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-06-01 01:51:28 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-06-01 01:51:28 -0700 |
| commit | 133b772fb5c8df6b4455c6f457800d4baa309518 (patch) | |
| tree | 71b08bbf12ec38cd9ad7e3545ae92736bc18bcfa /weed/storage/disk_location_ec.go | |
| parent | ba18314aab2531ff6d7223cb2cf976dc01aaa735 (diff) | |
| download | seaweedfs-133b772fb5c8df6b4455c6f457800d4baa309518.tar.xz seaweedfs-133b772fb5c8df6b4455c6f457800d4baa309518.zip | |
destroy ec volume if it is empty
Diffstat (limited to 'weed/storage/disk_location_ec.go')
| -rw-r--r-- | weed/storage/disk_location_ec.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go index 21f26e093..1cbb2c380 100644 --- a/weed/storage/disk_location_ec.go +++ b/weed/storage/disk_location_ec.go @@ -27,6 +27,17 @@ func (l *DiskLocation) FindEcVolume(vid needle.VolumeId) (*erasure_coding.EcVolu return nil, false } +func (l *DiskLocation) DestroyEcVolume(vid needle.VolumeId) { + l.ecVolumesLock.Lock() + defer l.ecVolumesLock.Unlock() + + ecVolume, found := l.ecVolumes[vid] + if found { + ecVolume.Destroy() + delete(l.ecVolumes,vid) + } +} + func (l *DiskLocation) FindEcShard(vid needle.VolumeId, shardId erasure_coding.ShardId) (*erasure_coding.EcVolumeShard, bool) { l.ecVolumesLock.RLock() defer l.ecVolumesLock.RUnlock() |
