mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-02-09 15:27:11 +00:00
lib/storage: properly update link for entry at dateMetricID cache (#4258)
previously during sync for mutable and immutable cache parts, link for hotEntry with current date may be not properly updated it corrupts cache for backfilling metrics and increased cpu load
This commit is contained in:
parent
4c3e0d4411
commit
e5e10988ed
1 changed files with 5 additions and 1 deletions
|
@ -2178,10 +2178,14 @@ func (dmc *dateMetricIDCache) syncLocked() {
|
|||
}
|
||||
v = v.Clone()
|
||||
v.Union(&e.v)
|
||||
byDateMutable.m[date] = &byDateMetricIDEntry{
|
||||
dme := &byDateMetricIDEntry{
|
||||
date: date,
|
||||
v: *v,
|
||||
}
|
||||
if date == byDateMutable.hotEntry.Load().(*byDateMetricIDEntry).date {
|
||||
byDateMutable.hotEntry.Store(dme)
|
||||
}
|
||||
byDateMutable.m[date] = dme
|
||||
}
|
||||
for date, e := range byDate.m {
|
||||
v := byDateMutable.get(date)
|
||||
|
|
Loading…
Reference in a new issue