Skip to content

Conversation

@gab8i
Copy link
Contributor

@gab8i gab8i commented Oct 8, 2025

No description provided.

gab8i added 2 commits October 8, 2025 17:58
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.
gab8i added 2 commits October 9, 2025 09:57
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`.
@gab8i gab8i changed the title [WIP] fix: Adress multiple fixes fix: Adress multiple fixes Oct 9, 2025
// cannot be removed.
parent_stack_page
.children_leaves_counter
.replace(new_parent_children_leaves_counter.try_into().unwrap());
Copy link

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.

Suggested change
.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)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@rphmeier rphmeier changed the title fix: Adress multiple fixes fix: Address multiple fixes Oct 9, 2025
@gab8i gab8i merged commit 24b8e41 into master Oct 10, 2025
8 checks passed
@gab8i gab8i deleted the mutliple_fixes branch October 10, 2025 10:44
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.

3 participants