lib/storage: do not take into account -storage.minFreeDiskSpaceBytes during background merges

This commit is contained in:
Aliaksandr Valialkin 2021-12-01 10:56:21 +02:00
parent 06eff5a72c
commit 2fb5a6ca78
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -978,10 +978,9 @@ func SetFinalMergeDelay(delay time.Duration) {
func getMaxOutBytes(path string, workersCount int) uint64 {
n := fs.MustGetFreeSpace(path)
if n < freeDiskSpaceLimitBytes {
return 0
}
n -= freeDiskSpaceLimitBytes
// Do not substract freeDiskSpaceLimitBytes from n before calculating the maxOutBytes,
// since this will result in sub-optimal merges - e.g. many small parts will be left unmerged.
// Divide free space by the max number concurrent merges.
maxOutBytes := n / uint64(workersCount)
if maxOutBytes > maxBigPartSize {