mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 21:54:10 -08:00
Fix race in chunkDesc.
Change-Id: Id7bae115d75886e10d44184a690a76777b1531fe
This commit is contained in:
parent
1c53c09558
commit
fd6600850a
|
@ -161,6 +161,9 @@ func (cd *chunkDesc) unpin() {
|
|||
}
|
||||
|
||||
func (cd *chunkDesc) firstTime() clientmodel.Timestamp {
|
||||
cd.Lock()
|
||||
defer cd.Unlock()
|
||||
|
||||
if cd.chunk == nil {
|
||||
return cd.firstTimeField
|
||||
}
|
||||
|
@ -168,6 +171,9 @@ func (cd *chunkDesc) firstTime() clientmodel.Timestamp {
|
|||
}
|
||||
|
||||
func (cd *chunkDesc) lastTime() clientmodel.Timestamp {
|
||||
cd.Lock()
|
||||
defer cd.Unlock()
|
||||
|
||||
if cd.chunk == nil {
|
||||
return cd.lastTimeField
|
||||
}
|
||||
|
@ -201,6 +207,7 @@ func (cd *chunkDesc) evictOnUnpin() {
|
|||
cd.evict = true
|
||||
}
|
||||
|
||||
// evictNow is an internal helper method.
|
||||
func (cd *chunkDesc) evictNow() {
|
||||
cd.firstTimeField = cd.chunk.firstTime()
|
||||
cd.lastTimeField = cd.chunk.lastTime()
|
||||
|
|
Loading…
Reference in a new issue