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

Fix issue where chainSampleIterator can obscure errors #540

Merged
merged 3 commits into from
Oct 12, 2023

Conversation

charleskorn
Copy link
Contributor

@charleskorn charleskorn commented Oct 11, 2023

If any iterator in a chainSampleIterator has a sample after the desired timestamp when Seek() is called, Seek() will not return ValNone.

If some iterators have failed (ie. calling innerIterator.Err() returns a non-nil value) and others have not, this behaviour may hide errors from those iterators: callers of Seek() will not receive ValNone and therefore won't know to check chainSampleIterator.Err().

Next() is susceptible to a similar issue if Next() is not called until the stream is completely exhausted.

I'll submit this fix upstream once we've tested Mimir with it.

@jhesketh
Copy link
Contributor

If some iterators have failed (ie. calling innerIterator.Err() returns a non-nil value) and others have not, this behaviour may hide errors from those iterators, as callers of Seek() will not receive ValNone and therefore check chainSampleIterator.Err().

Do you mean "... and therefore not check chainSampleIterator.Err()?"

@charleskorn
Copy link
Contributor Author

English is ambiguous :) I've tried to make it clearer.

Copy link
Contributor

@krajorama krajorama left a comment

Choose a reason for hiding this comment

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

LGTM

@charleskorn charleskorn changed the title Fix issue where chainSampleIterator.Seek() can obscure errors Fix issue where chainSampleIterator can obscure errors Oct 12, 2023
@charleskorn charleskorn merged commit f477e1b into main Oct 12, 2023
6 checks passed
@charleskorn charleskorn deleted the charleskorn/chainsampleiterator-bug branch October 12, 2023 01:47
charleskorn added a commit to grafana/mimir that referenced this pull request Oct 12, 2023
charleskorn added a commit to grafana/mimir that referenced this pull request Oct 12, 2023
* Upgrade mimir-prometheus

This brings in the fix from grafana/mimir-prometheus#540.

* Add changelog entry
@pracucci
Copy link
Collaborator

I'll submit this fix upstream once we've tested Mimir with it.

👍

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.

5 participants