Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distributor.queryIngesterStream: Free gRPC buffers upon error #9756

Merged
merged 2 commits into from
Oct 30, 2024

Conversation

aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented Oct 28, 2024

What this PR does

In Distributor.queryIngesterStream, free gRPC buffers when an error occurs in the queryIngester closure that gets passed to ring.DoMultiUntilQuorumWithoutSuccessfulContextCancellation. No attempt is made to free the buffers though if querying is successful, as the combined query response should retain references to said buffers. I add a comment for future reference as to why we don't free buffers in the success case.

See #9721 for background, as it reverts the Distributor.queryIngesterStream gRPC buffer freeing introduced in #9401 (due to race conditions essentially, as the combined query response retains gRPC buffer references).

I've run the TestBothEnginesReturnSameResultsForBenchmarkQueries tests in pkg/streamingpromql/benchmarks with race detection enabled, and no problems are found.

Which issue(s) this PR fixes or relates to

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

@aknuds1 aknuds1 requested review from colega and charleskorn October 28, 2024 09:12
@aknuds1 aknuds1 marked this pull request as ready for review October 28, 2024 09:26
@aknuds1 aknuds1 requested a review from a team as a code owner October 28, 2024 09:26
pkg/distributor/query.go Outdated Show resolved Hide resolved
@aknuds1 aknuds1 force-pushed the arve/free-grpc-buffers branch from 59c3ea9 to d17921b Compare October 28, 2024 16:10
@aknuds1 aknuds1 requested a review from colega October 28, 2024 16:10
@aknuds1 aknuds1 merged commit eda1a4b into main Oct 30, 2024
29 checks passed
@aknuds1 aknuds1 deleted the arve/free-grpc-buffers branch October 30, 2024 10:53
duricanikolic added a commit that referenced this pull request Nov 4, 2024
* Revert "Don't free buffers after reading query stream (#9721)"

This reverts commit f7b6017.

* Revert: Upgrade to google.golang.org/grpc v1.66.2 / modify certain protobuf messages to retain their unmarshaling buffer (#9401)

Signed-off-by: Yuri Nikolic <[email protected]>

* Revert "Distributor.queryIngesterStream: Free gRPC buffers upon error (#9756)"

This reverts commit eda1a4b.

---------

Signed-off-by: Yuri Nikolic <[email protected]>
aknuds1 added a commit that referenced this pull request Nov 4, 2024
* [release-2.14] fix(deps): update github.com/thanos-io/objstore digest to f90c89a (main) (#9625)

* Update github.com/thanos-io/objstore digest to f90c89a (#9534)

Signed-off-by: Arve Knudsen <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
(cherry picked from commit 3c97a61)

* update changelog

Signed-off-by: Vladimir Varankin <[email protected]>

---------

Signed-off-by: Vladimir Varankin <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Vladimir Varankin <[email protected]>

* 2.14.1 Prepare patch release (#9796)

* bump patch version

Signed-off-by: Vladimir Varankin <[email protected]>

* rebuild assets

Signed-off-by: Vladimir Varankin <[email protected]>

---------

Signed-off-by: Vladimir Varankin <[email protected]>

* MQE: Fix handling of string results (#9803)

This would previously panic after the query was closed

* chore(deps): update grafana/mimirtool docker tag to v2.14.1 (#9806)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Revert upgrade to google.golang.org/grpc v1.66.2 (#9811)

* Revert "Don't free buffers after reading query stream (#9721)"

This reverts commit f7b6017.

* Revert: Upgrade to google.golang.org/grpc v1.66.2 / modify certain protobuf messages to retain their unmarshaling buffer (#9401)

Signed-off-by: Yuri Nikolic <[email protected]>

* Revert "Distributor.queryIngesterStream: Free gRPC buffers upon error (#9756)"

This reverts commit eda1a4b.

---------

Signed-off-by: Yuri Nikolic <[email protected]>

* Improve lock contention affecting read and write latencies during TSDB head compaction (cherry-pick Prometheus PR 15242) (#9822)

* Cherry-pick Prometheus PR 15242

Signed-off-by: Marco Pracucci <[email protected]>

* Added CHANGELOG entry

Signed-off-by: Marco Pracucci <[email protected]>

* Updated CHANGELOG

Signed-off-by: Marco Pracucci <[email protected]>

---------

Signed-off-by: Marco Pracucci <[email protected]>

---------

Signed-off-by: Vladimir Varankin <[email protected]>
Signed-off-by: Yuri Nikolic <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
Co-authored-by: Grot (@grafanabot) <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Vladimir Varankin <[email protected]>
Co-authored-by: Joshua Hesketh <[email protected]>
Co-authored-by: Đurica Yuri Nikolić <[email protected]>
Co-authored-by: Marco Pracucci <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants