prometheus/tsdb/index
Oleg Zaytsev 10a3c7220b
MemPostings.PostingsForLabelMatching(): don't hold the mutex while matching (#14286)
* MemPostings.PostingsForLabelMatching: let mutex go

This changes the `MemPostings.PostingsForLabelMatching` implementation
to stop holding the read mutex while matching the label values.

We've seen that this method can be slow when the matcher is expensive,
that's why we even added a context expiration check.

However, there are critical process that might be waiting on this mutex:
writes (adding new series) and compaction (deleting the
garbage-collected ones), so we should avoid holding it for a long period
of time.

Given that we've copied the values to a slice anyway, there's no need to
hold the lock while matching.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-06-10 14:24:17 +02:00
..
index.go Check context every 128 labels instead of 100 (#14118) 2024-05-21 11:30:43 +02:00
index_test.go tsdb/index: Fix TestReader_PostingsForLabelMatchingHonorsContextCancel 2024-06-03 17:29:06 +02:00
postings.go MemPostings.PostingsForLabelMatching(): don't hold the mutex while matching (#14286) 2024-06-10 14:24:17 +02:00
postings_test.go MemPostings.PostingsForLabelMatching(): don't hold the mutex while matching (#14286) 2024-06-10 14:24:17 +02:00
postingsstats.go Move from golang.org/x/exp/slices into slices now that we only support Go >= 1.21 2024-02-28 14:54:53 +01:00
postingsstats_test.go golangci-lint: enable testifylint linter (#13254) 2023-12-07 11:35:01 +00:00