-
Notifications
You must be signed in to change notification settings - Fork 29
fix: Address multiple fixes #921
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
Conversation
Add a field to keep track of the previous amount of leaves within the page and its children in order to extract a delta of new leaves (either negative or positive) to properly propagate the information upwards to other pages.
There are rare occasions when the left worker creates a page that was previously elided by the right worker. In this case, this fix ensures that the page is properly updated without deleting it (which was happening before). The reason this happens is that the leaf and branch stages, while handling merges, update the cutoff of each node. The cutoff updated after the deletion of a node can also be used as a new high range sent to the left worker. Thus, the left worker thinks that everything between the last modified page sent by the right worker and the new high range has free keys to be used as separators, and those separators could have previously been eliminated by the right worker.
Stop using `or`, which eagerly evaluates, and instead use `or_else`.
| // cannot be removed. | ||
| parent_stack_page | ||
| .children_leaves_counter | ||
| .replace(new_parent_children_leaves_counter.try_into().unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unwrap() call requires explicit justification. While lines 892-894 provide general context about the expectation that page and children deltas cannot exceed the parent counter when negative, this specific try_into().unwrap() conversion lacks documentation explaining why the conversion from i64 to u64 will never fail. Add a comment above this line or include the justification in the unwrap message to explain why new_parent_children_leaves_counter is guaranteed to be non-negative.
| .replace(new_parent_children_leaves_counter.try_into().unwrap()); | |
| // new_parent_children_leaves_counter is guaranteed to be non-negative here | |
| // because we've already verified that the page and children deltas cannot | |
| // exceed the parent counter when negative | |
| .replace(new_parent_children_leaves_counter.try_into().expect( | |
| "Counter must be non-negative after delta application", | |
| )); |
Spotted by Graphite Agent (based on custom rule: Custom rules)
Is this helpful? React 👍 or 👎 to let us know.
No description provided.