also remove volumeLayout if collection is empty

This commit is contained in:
Chris Lu
2018-07-11 02:01:33 -07:00
parent 1e1c368ae8
commit f7afa80250
4 changed files with 54 additions and 8 deletions

View File

@@ -107,6 +107,13 @@ func (vl *VolumeLayout) isWritable(v *storage.VolumeInfo) bool {
!v.ReadOnly
}
func (vl *VolumeLayout) isEmpty() bool {
vl.accessLock.RLock()
defer vl.accessLock.RUnlock()
return len(vl.vid2location) == 0
}
func (vl *VolumeLayout) Lookup(vid storage.VolumeId) []*DataNode {
vl.accessLock.RLock()
defer vl.accessLock.RUnlock()