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 cf1d2f289b
commit 2e43cd9d62
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 { func getMaxOutBytes(path string, workersCount int) uint64 {
n := fs.MustGetFreeSpace(path) n := fs.MustGetFreeSpace(path)
if n < freeDiskSpaceLimitBytes { // Do not substract freeDiskSpaceLimitBytes from n before calculating the maxOutBytes,
return 0 // since this will result in sub-optimal merges - e.g. many small parts will be left unmerged.
}
n -= freeDiskSpaceLimitBytes
// Divide free space by the max number concurrent merges. // Divide free space by the max number concurrent merges.
maxOutBytes := n / uint64(workersCount) maxOutBytes := n / uint64(workersCount)
if maxOutBytes > maxBigPartSize { if maxOutBytes > maxBigPartSize {