mirror of
https://github.com/prometheus/prometheus
synced 2024-12-29 02:02:17 +00:00
Fix race condition when updating lastSeriesID during loading chunk snapshot (#11099)
Signed-off-by: Xiaochao Dong (@damnever) <the.xcdong@gmail.com>
This commit is contained in:
parent
4035b38c59
commit
1078081aec
@ -921,8 +921,12 @@ func (h *Head) loadChunkSnapshot() (int, int, map[chunks.HeadSeriesRef]*memSerie
|
||||
return
|
||||
}
|
||||
localRefSeries[csr.ref] = series
|
||||
if chunks.HeadSeriesRef(h.lastSeriesID.Load()) < series.ref {
|
||||
h.lastSeriesID.Store(uint64(series.ref))
|
||||
for {
|
||||
seriesID := uint64(series.ref)
|
||||
lastSeriesID := h.lastSeriesID.Load()
|
||||
if lastSeriesID >= seriesID || h.lastSeriesID.CAS(lastSeriesID, seriesID) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
series.chunkRange = csr.chunkRange
|
||||
|
Loading…
Reference in New Issue
Block a user