mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: handle common case when the number of rows passed to flushRowsToInmemoryParts() doesnt exceed maxRawRowsPerShard
This commit is contained in:
parent
73f0a805e2
commit
e8b3045062
1 changed files with 10 additions and 1 deletions
|
@ -506,8 +506,17 @@ func (pt *partition) flushRowsToInmemoryParts(rows []rawRow) {
|
|||
return
|
||||
}
|
||||
|
||||
// Merge rows into in-memory parts.
|
||||
maxRows := maxRawRowsPerShard
|
||||
if len(rows) <= maxRows {
|
||||
// Common case - convert rows to a single in-memory part
|
||||
pw := pt.createInmemoryPart(rows)
|
||||
if pw != nil {
|
||||
pt.addToInmemoryParts(pw)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Merge rows into in-memory parts.
|
||||
var pwsLock sync.Mutex
|
||||
pws := make([]*partWrapper, 0, (len(rows)+maxRows-1)/maxRows)
|
||||
wg := getWaitGroup()
|
||||
|
|
Loading…
Reference in a new issue