mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/{mergeset,storage}: prevent from long wait time when creating a snapshot under high data ingestion rate
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3551 Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/3873
This commit is contained in:
parent
67a526f5f7
commit
e7c20f0c75
3 changed files with 24 additions and 52 deletions
|
@ -15,6 +15,8 @@ The following tip changes can be tested by building VictoriaMetrics components f
|
|||
|
||||
## v1.87.x long-time support release (LTS)
|
||||
|
||||
* BUGFIX: prevent from slow [snapshot creating](https://docs.victoriametrics.com/#how-to-work-with-snapshots) under high data ingestion rate. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3551).
|
||||
|
||||
## [v1.87.3](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.87.3)
|
||||
|
||||
Released at 2023-03-12
|
||||
|
|
|
@ -662,7 +662,6 @@ func (tb *Table) flushInmemoryItems() {
|
|||
}
|
||||
|
||||
func (tb *Table) flushInmemoryParts(isFinal bool) {
|
||||
for {
|
||||
currentTime := time.Now()
|
||||
var pws []*partWrapper
|
||||
|
||||
|
@ -678,20 +677,6 @@ func (tb *Table) flushInmemoryParts(isFinal bool) {
|
|||
if err := tb.mergePartsOptimal(pws); err != nil {
|
||||
logger.Panicf("FATAL: cannot merge in-memory parts: %s", err)
|
||||
}
|
||||
if !isFinal {
|
||||
return
|
||||
}
|
||||
tb.partsLock.Lock()
|
||||
n := len(tb.inmemoryParts)
|
||||
tb.partsLock.Unlock()
|
||||
if n == 0 {
|
||||
// All the in-memory parts were flushed to disk.
|
||||
return
|
||||
}
|
||||
// Some parts weren't flushed to disk because they were being merged.
|
||||
// Sleep for a while and try flushing them again.
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
||||
func (riss *rawItemsShards) flush(tb *Table, dst []*inmemoryBlock, isFinal bool) []*inmemoryBlock {
|
||||
|
|
|
@ -871,7 +871,6 @@ func (pt *partition) flushInmemoryRows() {
|
|||
}
|
||||
|
||||
func (pt *partition) flushInmemoryParts(isFinal bool) {
|
||||
for {
|
||||
currentTime := time.Now()
|
||||
var pws []*partWrapper
|
||||
|
||||
|
@ -887,20 +886,6 @@ func (pt *partition) flushInmemoryParts(isFinal bool) {
|
|||
if err := pt.mergePartsOptimal(pws, nil); err != nil {
|
||||
logger.Panicf("FATAL: cannot merge in-memory parts: %s", err)
|
||||
}
|
||||
if !isFinal {
|
||||
return
|
||||
}
|
||||
pt.partsLock.Lock()
|
||||
n := len(pt.inmemoryParts)
|
||||
pt.partsLock.Unlock()
|
||||
if n == 0 {
|
||||
// All the in-memory parts were flushed to disk.
|
||||
return
|
||||
}
|
||||
// Some parts weren't flushed to disk because they were being merged.
|
||||
// Sleep for a while and try flushing them again.
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
||||
func (rrss *rawRowsShards) flush(pt *partition, dst []rawRow, isFinal bool) []rawRow {
|
||||
|
|
Loading…
Reference in a new issue