Fix Gridstore has_pointer to account for delete pending operation#7638
Merged
Fix Gridstore has_pointer to account for delete pending operation#7638
Conversation
agourlay
commented
Dec 1, 2025
|
|
||
| pub fn has_pointer(&self, point_offset: PointOffset) -> bool { | ||
| self.pending_updates.contains_key(&point_offset) || self.get(point_offset).is_some() | ||
| self.get(point_offset).is_some() |
Member
Author
There was a problem hiding this comment.
pending_updates.contains_key is not correct, the pending operation might be a delete
the get method implements this check properly internally
Member
There was a problem hiding this comment.
Thanks!
The key thing is that self.get(point_offset) always represents the latest data. And so pending_updates must be ignored here as it's purely for persisting storage separately.
agourlay
commented
Dec 1, 2025
| Put(PointOffset, Payload), | ||
| Delete(PointOffset), | ||
| Update(PointOffset, Payload), | ||
| Get(PointOffset), |
Member
Author
There was a problem hiding this comment.
discovered the bug while improving our randomized test :)
timvisee
approved these changes
Dec 1, 2025
Member
timvisee
left a comment
There was a problem hiding this comment.
Thanks for the updated tests 🙏
timvisee
pushed a commit
that referenced
this pull request
Dec 3, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR fixes a bug in Gridstore's
has_pointeroperation.The bug manifests itself by an incorrect result from the
put_valueoperation.The contract for the returned boolean is
The value returned was incorrect in case of a delete operation present in the pending operation.
Luckily for us, no call site for
put_valueseems to rely on this returned information 😌