mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Simplify position mapper updating
This commit is contained in:
parent
142c89b8b0
commit
4c4e0c614e
12
head.go
12
head.go
|
@ -403,9 +403,6 @@ func (h *HeadBlock) fullness() float64 {
|
|||
}
|
||||
|
||||
func (h *HeadBlock) updateMapping() {
|
||||
h.mapper.mtx.Lock()
|
||||
defer h.mapper.mtx.Unlock()
|
||||
|
||||
h.mtx.RLock()
|
||||
|
||||
if h.mapper.sortable != nil && h.mapper.Len() == len(h.descs) {
|
||||
|
@ -435,15 +432,12 @@ func (h *HeadBlock) remapPostings(p Postings) Postings {
|
|||
return errPostings{err: err}
|
||||
}
|
||||
|
||||
h.mapper.mtx.RLock()
|
||||
defer h.mapper.mtx.RUnlock()
|
||||
h.mapper.mtx.Lock()
|
||||
defer h.mapper.mtx.Unlock()
|
||||
|
||||
h.updateMapping()
|
||||
h.mapper.Sort(list)
|
||||
|
||||
slice.Sort(list, func(i, j int) bool {
|
||||
return h.mapper.fw[list[i]] < h.mapper.fw[list[j]]
|
||||
})
|
||||
|
||||
return newListPostings(list)
|
||||
}
|
||||
|
||||
|
|
|
@ -64,11 +64,8 @@ func (s *DB) Querier(mint, maxt int64) Querier {
|
|||
|
||||
// TODO(fabxc): find nicer solution.
|
||||
if hb, ok := b.(*HeadBlock); ok {
|
||||
hb.updateMapping()
|
||||
q.postingsMapper = hb.remapPostings
|
||||
q.series = &headSeriesReader{
|
||||
h: hb,
|
||||
}
|
||||
q.series = &headSeriesReader{h: hb}
|
||||
}
|
||||
|
||||
sq.blocks = append(sq.blocks, q)
|
||||
|
|
Loading…
Reference in a new issue