-
Notifications
You must be signed in to change notification settings - Fork 634
MQE: fix issue where a query with a common subexpression could return incorrect results #11989
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lamida
approved these changes
Jul 7, 2025
mimir-github-bot bot
pushed a commit
that referenced
this pull request
Jul 7, 2025
… incorrect results (#11989) #### What this PR does This PR fixes an issue where common subexpression elimination (CSE) can cause a query to return incorrect query results. The issue would occur if the ring buffer used to buffer data was in a state where the head of the buffer is at the end of the slice, and the tail was at the beginning of the slice. In this case, calling `Remove` for the item at the end of the slice would return the correct value, as would the subsequent call for the item at the beginning of the slice, but all following calls would return incorrect values. #### Which issue(s) this PR fixes or relates to #11189 #### Checklist - [x] Tests updated. - [n/a] Documentation added. - [covered by #10067] `CHANGELOG.md` updated - the order of entries should be `[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`. If changelog entry is not needed, please add the `changelog-not-needed` label to the PR. - [n/a] [`about-versioning.md`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md) updated with experimental features. (cherry picked from commit 8c9ffff)
mimir-github-bot bot
pushed a commit
that referenced
this pull request
Jul 7, 2025
… incorrect results (#11989) #### What this PR does This PR fixes an issue where common subexpression elimination (CSE) can cause a query to return incorrect query results. The issue would occur if the ring buffer used to buffer data was in a state where the head of the buffer is at the end of the slice, and the tail was at the beginning of the slice. In this case, calling `Remove` for the item at the end of the slice would return the correct value, as would the subsequent call for the item at the beginning of the slice, but all following calls would return incorrect values. #### Which issue(s) this PR fixes or relates to #11189 #### Checklist - [x] Tests updated. - [n/a] Documentation added. - [covered by #10067] `CHANGELOG.md` updated - the order of entries should be `[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`. If changelog entry is not needed, please add the `changelog-not-needed` label to the PR. - [n/a] [`about-versioning.md`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md) updated with experimental features. (cherry picked from commit 8c9ffff)
mimir-github-bot bot
pushed a commit
that referenced
this pull request
Jul 7, 2025
… incorrect results (#11989) #### What this PR does This PR fixes an issue where common subexpression elimination (CSE) can cause a query to return incorrect query results. The issue would occur if the ring buffer used to buffer data was in a state where the head of the buffer is at the end of the slice, and the tail was at the beginning of the slice. In this case, calling `Remove` for the item at the end of the slice would return the correct value, as would the subsequent call for the item at the beginning of the slice, but all following calls would return incorrect values. #### Which issue(s) this PR fixes or relates to #11189 #### Checklist - [x] Tests updated. - [n/a] Documentation added. - [covered by #10067] `CHANGELOG.md` updated - the order of entries should be `[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`. If changelog entry is not needed, please add the `changelog-not-needed` label to the PR. - [n/a] [`about-versioning.md`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md) updated with experimental features. (cherry picked from commit 8c9ffff)
mimir-github-bot bot
pushed a commit
that referenced
this pull request
Jul 7, 2025
… incorrect results (#11989) #### What this PR does This PR fixes an issue where common subexpression elimination (CSE) can cause a query to return incorrect query results. The issue would occur if the ring buffer used to buffer data was in a state where the head of the buffer is at the end of the slice, and the tail was at the beginning of the slice. In this case, calling `Remove` for the item at the end of the slice would return the correct value, as would the subsequent call for the item at the beginning of the slice, but all following calls would return incorrect values. #### Which issue(s) this PR fixes or relates to #11189 #### Checklist - [x] Tests updated. - [n/a] Documentation added. - [covered by #10067] `CHANGELOG.md` updated - the order of entries should be `[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`. If changelog entry is not needed, please add the `changelog-not-needed` label to the PR. - [n/a] [`about-versioning.md`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md) updated with experimental features. (cherry picked from commit 8c9ffff)
mimir-github-bot bot
pushed a commit
that referenced
this pull request
Jul 7, 2025
… incorrect results (#11989) #### What this PR does This PR fixes an issue where common subexpression elimination (CSE) can cause a query to return incorrect query results. The issue would occur if the ring buffer used to buffer data was in a state where the head of the buffer is at the end of the slice, and the tail was at the beginning of the slice. In this case, calling `Remove` for the item at the end of the slice would return the correct value, as would the subsequent call for the item at the beginning of the slice, but all following calls would return incorrect values. #### Which issue(s) this PR fixes or relates to #11189 #### Checklist - [x] Tests updated. - [n/a] Documentation added. - [covered by #10067] `CHANGELOG.md` updated - the order of entries should be `[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`. If changelog entry is not needed, please add the `changelog-not-needed` label to the PR. - [n/a] [`about-versioning.md`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md) updated with experimental features. (cherry picked from commit 8c9ffff)
mimir-github-bot bot
pushed a commit
that referenced
this pull request
Jul 7, 2025
… incorrect results (#11989) #### What this PR does This PR fixes an issue where common subexpression elimination (CSE) can cause a query to return incorrect query results. The issue would occur if the ring buffer used to buffer data was in a state where the head of the buffer is at the end of the slice, and the tail was at the beginning of the slice. In this case, calling `Remove` for the item at the end of the slice would return the correct value, as would the subsequent call for the item at the beginning of the slice, but all following calls would return incorrect values. #### Which issue(s) this PR fixes or relates to #11189 #### Checklist - [x] Tests updated. - [n/a] Documentation added. - [covered by #10067] `CHANGELOG.md` updated - the order of entries should be `[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`. If changelog entry is not needed, please add the `changelog-not-needed` label to the PR. - [n/a] [`about-versioning.md`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md) updated with experimental features. (cherry picked from commit 8c9ffff)
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-11989-to-release-2.17 origin/release-2.17
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 8c9fffff376a6433f9d5713cdf88ee757ab4397e
# Push it to GitHub
git push --set-upstream origin backport-11989-to-release-2.17
git switch main
# Remove the local backport branch
git branch -D backport-11989-to-release-2.17 Then, create a pull request where the |
Backport to 2.17 isn't necessary, as the release is based on the r350 branch and this fix was already backported there. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport r345
backport r346
backport r347
backport r348
backport r349
backport r350
backport-failed
changelog-not-needed
PRs that don't need a CHANGELOG.md entry
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does
This PR fixes an issue where common subexpression elimination (CSE) can cause a query to return incorrect query results.
The issue would occur if the ring buffer used to buffer data was in a state where the head of the buffer is at the end of the slice, and the tail was at the beginning of the slice. In this case, calling
Remove
for the item at the end of the slice would return the correct value, as would the subsequent call for the item at the beginning of the slice, but all following calls would return incorrect values.Which issue(s) this PR fixes or relates to
#11189
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
. If changelog entry is not needed, please add thechangelog-not-needed
label to the PR.about-versioning.md
updated with experimental features.