Skip to content

Conversation

jhesketh
Copy link
Contributor

@jhesketh jhesketh commented Aug 28, 2024

What this PR does

  • Panics when we try to Put more objects back into the pool then expected. This likely means we have queries interfering with each other, so panic'ing is appropriate.
  • During tests, panic when we don't put all the objects back into their pools.
  • Fix a bug where we would unnecessarily get extra slices in binary operations.

Which issue(s) this PR fixes or relates to

Related to https://github.com/grafana/mimir-squad/issues/2280

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.

@jhesketh jhesketh marked this pull request as ready for review August 28, 2024 05:23
@jhesketh jhesketh requested a review from a team as a code owner August 28, 2024 05:23
Comment on lines 47 to 48
// Increase the memory tracker for 2 FPoints, and 1 HPoint
memoryConsumptionTracker.IncreaseMemoryConsumption(types.FPointSize*2 + types.HPointSize*1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary? Can't we just assert that CurrentEstimatedMemoryConsumptionBytes is 0 below?

(same comment applies to the other similar changes in this file)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the functions we're testing actually call DecreaseMemoryConsumption at some point, which requires the current estimated memory to be larger than what is returned. I figured may as well put in real values if that path is being executed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm missing something: where is DecreaseMemoryConsumption called in this test? floatTransformationFunc reuses the slice it's passed.

(I can see this is necessary for TestFloatTransformationDropHistogramsFunc though)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, sorry, I see your point. I'm doing this for consistency with TestFloatTransformationDropHistogramsFunc

@jhesketh jhesketh enabled auto-merge (squash) August 28, 2024 06:35
Copy link
Contributor

@charleskorn charleskorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and nice catch on the issue in the binary operator 🚀

@jhesketh jhesketh merged commit 40da1cb into grafana:main Aug 28, 2024
29 checks passed
@jhesketh jhesketh deleted the jhesketh/mqe-mempanic branch August 28, 2024 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants