mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Don't do anything if MemPostings are empty
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
This commit is contained in:
parent
9c417aa710
commit
ccd0308abc
|
@ -293,10 +293,12 @@ func (p *MemPostings) EnsureOrder(numberOfConcurrentProcesses int) {
|
||||||
func (p *MemPostings) Delete(deleted map[storage.SeriesRef]struct{}, affected map[labels.Label]struct{}) {
|
func (p *MemPostings) Delete(deleted map[storage.SeriesRef]struct{}, affected map[labels.Label]struct{}) {
|
||||||
p.mtx.Lock()
|
p.mtx.Lock()
|
||||||
defer p.mtx.Unlock()
|
defer p.mtx.Unlock()
|
||||||
|
if len(p.m) == 0 || len(deleted) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Deleting label names mutates p.m map, so it should be done from a single goroutine after nobody else is reading it.
|
// Deleting label names mutates p.m map, so it should be done from a single goroutine after nobody else is reading it.
|
||||||
// Adding +1 to length to account for allPostingsKey processing when MemPostings is empty.
|
deleteLabelNames := make(chan string, len(p.m))
|
||||||
deleteLabelNames := make(chan string, len(p.m)+1)
|
|
||||||
|
|
||||||
process := func(l labels.Label) {
|
process := func(l labels.Label) {
|
||||||
orig := p.m[l.Name][l.Value]
|
orig := p.m[l.Name][l.Value]
|
||||||
|
|
Loading…
Reference in a new issue