From c2deee991189c46e9adf233bc0eab3000a023975 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 27 Jul 2021 12:02:52 +0300 Subject: [PATCH] lib/storage: yet another attempt to properly determine disk space shortage, which prevents from optimal merges Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1373 --- lib/storage/partition.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/storage/partition.go b/lib/storage/partition.go index 46b33b3a74..f69967f928 100644 --- a/lib/storage/partition.go +++ b/lib/storage/partition.go @@ -1425,15 +1425,17 @@ func appendPartsToMerge(dst, src []*partWrapper, maxPartsToMerge int, maxRows ui for i := minSrcParts; i <= maxSrcParts; i++ { for j := 0; j <= len(src)-i; j++ { a := src[j : j+i] + rowsCount := getRowsCount(a) + if rowsCount > maxRows { + needFreeSpace = true + } if a[0].p.ph.RowsCount*uint64(len(a)) < a[len(a)-1].p.ph.RowsCount { // Do not merge parts with too big difference in rows count, // since this results in unbalanced merges. continue } - rowsCount := getRowsCount(a) if rowsCount > maxRows { // There is no need in verifying remaining parts with higher number of rows - needFreeSpace = true break } m := float64(rowsCount) / float64(a[len(a)-1].p.ph.RowsCount)