Fix deadlock with empty MemPostings

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
pull/14975/head
Oleg Zaytsev 2 months ago
parent e196b977af
commit 9c417aa710
No known key found for this signature in database
GPG Key ID: 7E9FE9FD48F512EF

@ -295,7 +295,8 @@ func (p *MemPostings) Delete(deleted map[storage.SeriesRef]struct{}, affected ma
defer p.mtx.Unlock()
// Deleting label names mutates p.m map, so it should be done from a single goroutine after nobody else is reading it.
deleteLabelNames := make(chan string, len(p.m))
// Adding +1 to length to account for allPostingsKey processing when MemPostings is empty.
deleteLabelNames := make(chan string, len(p.m)+1)
process := func(l labels.Label) {
orig := p.m[l.Name][l.Value]

Loading…
Cancel
Save