lib/storage: take into account -storage.minFreeDiskSpaceBytes when performing big merges

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/269
This commit is contained in:
Aliaksandr Valialkin 2021-11-30 12:50:23 +02:00
parent f67427ae61
commit d666755159
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -978,6 +978,10 @@ func SetFinalMergeDelay(delay time.Duration) {
func getMaxOutBytes(path string, workersCount int) uint64 {
n := fs.MustGetFreeSpace(path)
if n < freeDiskSpaceLimitBytes {
return 0
}
n -= freeDiskSpaceLimitBytes
// Divide free space by the max number concurrent merges.
maxOutBytes := n / uint64(workersCount)
if maxOutBytes > maxBigPartSize {