Skip to content

Fix reuse slice in distributor.Push() #1898

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

Merged

Conversation

pracucci
Copy link
Contributor

What this PR does:
While investigating the issue #1895, I've realized the request slice is not reused in case the request gets skipped because of HA dedup or rate limiting. In case all incoming requests have the HA enabled, it's 50% of requests. This PR fixes it.

Which issue(s) this PR fixes:
No issue

Checklist

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

Copy link
Contributor

@codesome codesome left a comment

Choose a reason for hiding this comment

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

I am wondering if we should do it in a defer statement if there was an error?

@pracucci
Copy link
Contributor Author

I am wondering if we should do it in a defer statement if there was an error?

@codesome In case of error it's OK doing it before return, so I don't think there's any real value paying the cost of a defer. If you mean adding a defer at the beginning of the function, to cover all cases at once, unfortunately we can't do it because of the async nature of ring.DoBatch(): when the execution reaches that point, the req needs to be alive even after the distributor.Push() completes.

@gouthamve gouthamve merged commit 335210d into cortexproject:master Dec 11, 2019
@pracucci pracucci deleted the fix-reuse-slice-for-deduped-series branch December 11, 2019 13:23
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.

4 participants