mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: yet another attempt to properly determine disk space shortage, which prevents from optimal merges
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1373
This commit is contained in:
parent
bb31117555
commit
c2deee9911
1 changed files with 4 additions and 2 deletions
|
@ -1425,15 +1425,17 @@ func appendPartsToMerge(dst, src []*partWrapper, maxPartsToMerge int, maxRows ui
|
||||||
for i := minSrcParts; i <= maxSrcParts; i++ {
|
for i := minSrcParts; i <= maxSrcParts; i++ {
|
||||||
for j := 0; j <= len(src)-i; j++ {
|
for j := 0; j <= len(src)-i; j++ {
|
||||||
a := src[j : j+i]
|
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 {
|
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,
|
// Do not merge parts with too big difference in rows count,
|
||||||
// since this results in unbalanced merges.
|
// since this results in unbalanced merges.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
rowsCount := getRowsCount(a)
|
|
||||||
if rowsCount > maxRows {
|
if rowsCount > maxRows {
|
||||||
// There is no need in verifying remaining parts with higher number of rows
|
// There is no need in verifying remaining parts with higher number of rows
|
||||||
needFreeSpace = true
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
m := float64(rowsCount) / float64(a[len(a)-1].p.ph.RowsCount)
|
m := float64(rowsCount) / float64(a[len(a)-1].p.ph.RowsCount)
|
||||||
|
|
Loading…
Reference in a new issue