factor in existing ec volume count when estimating max volume count
related to https://github.com/seaweedfs/seaweedfs/issues/5191
This commit is contained in:
@@ -218,9 +218,13 @@ func (l *DiskLocation) unmountEcVolumeByCollection(collectionName string) map[ne
|
|||||||
return deltaVols
|
return deltaVols
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *DiskLocation) EcVolumesLen() int {
|
func (l *DiskLocation) EcShardCount() int {
|
||||||
l.ecVolumesLock.RLock()
|
l.ecVolumesLock.RLock()
|
||||||
defer l.ecVolumesLock.RUnlock()
|
defer l.ecVolumesLock.RUnlock()
|
||||||
|
|
||||||
return len(l.ecVolumes)
|
shardCount := 0
|
||||||
|
for _, ecVolume := range l.ecVolumes {
|
||||||
|
shardCount += len(ecVolume.Shards)
|
||||||
|
}
|
||||||
|
return shardCount
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ func (s *Store) FindFreeLocation(diskType DiskType) (ret *DiskLocation) {
|
|||||||
}
|
}
|
||||||
currentFreeCount := location.MaxVolumeCount - int32(location.VolumesLen())
|
currentFreeCount := location.MaxVolumeCount - int32(location.VolumesLen())
|
||||||
currentFreeCount *= erasure_coding.DataShardsCount
|
currentFreeCount *= erasure_coding.DataShardsCount
|
||||||
currentFreeCount -= int32(location.EcVolumesLen())
|
currentFreeCount -= int32(location.EcShardCount())
|
||||||
currentFreeCount /= erasure_coding.DataShardsCount
|
currentFreeCount /= erasure_coding.DataShardsCount
|
||||||
if currentFreeCount > max {
|
if currentFreeCount > max {
|
||||||
max = currentFreeCount
|
max = currentFreeCount
|
||||||
|
|||||||
Reference in New Issue
Block a user