mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
lib/storage: fix infinite loop introduced in aa9b56a046
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1338 Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1244
This commit is contained in:
parent
0efd37cec1
commit
a207be3ffb
1 changed files with 5 additions and 8 deletions
|
@ -485,14 +485,11 @@ func (rrs *rawRowsShard) addRows(pt *partition, rows []rawRow) {
|
|||
rrs.rows = make([]rawRow, 0, n)
|
||||
}
|
||||
maxRowsCount := cap(rrs.rows)
|
||||
for {
|
||||
capacity := maxRowsCount - len(rrs.rows)
|
||||
if capacity >= len(rows) {
|
||||
// Fast path - rows fit capacity.
|
||||
rrs.rows = append(rrs.rows, rows...)
|
||||
break
|
||||
}
|
||||
|
||||
capacity := maxRowsCount - len(rrs.rows)
|
||||
if capacity >= len(rows) {
|
||||
// Fast path - rows fit capacity.
|
||||
rrs.rows = append(rrs.rows, rows...)
|
||||
} else {
|
||||
// Slow path - rows don't fit capacity.
|
||||
// Put rrs.rows and rows to rowsToFlush and convert it to a part.
|
||||
rowsToFlush = append(rowsToFlush, rrs.rows...)
|
||||
|
|
Loading…
Reference in a new issue