-
Notifications
You must be signed in to change notification settings - Fork 1
[Core] Add try_link: atomic accept-or-forward slot decision #99
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
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6a1e34a
[feat][core] Add try_link atomic slot decision
thep2p 1edb313
[cleanup][docs] Capitalize try_link doc comments
thep2p 80a1ec2
[cleanup][docs] Fix try_link doc grammar and casing
thep2p 731a077
[improve][docs] Document try_link candidate-side precondition
thep2p File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
This accept-vs-forward decision compares only
existing.id()vscandidate.id(); it can't checkcandidateagainst this node's id, because the lookup table doesn't store it. So it silently trusts the caller to pass a candidate on the correct side of this node fordirection(Right ⇒candidate.id() > self.id(), Left ⇒<).If a caller violates that (e.g. a
candidate.id() < self.id()passed into a Right slot), this comparison is meaningless and an out-of-order neighbor is installed silently — table corruption rather than an error.Suggest a
///precondition line ontry_link, and optionally adebug_assert!at the call site (where self's id is known) so misuse fails loudly in tests instead of silently corrupting the table. Non-blocking.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.
Good catch, thanks. Confirmed against
docs/protocol/concurrent-insert.md§4.1/§4.3: the spec's ownchange_neighborpseudocode has the same shape — it only ever compares the existing entry against the candidate, never the candidate against self. Sotry_linkis deliberately a low-level, trusted primitive; the caller (the not-yet-writtenGetLinkOp/BuddyOphandler) owns the "candidate is on the correct side" guarantee.Added a
# Preconditionsdoc section on the trait in 731a077 spelling this out. Held off on thedebug_assert!— there's no call site yet (this PR only adds the primitive, nothing wires it in), and it can't live insidetry_linkitself sinceArrayLookupTablehas no notion of its own owner's id by design. Makes sense to add the assert at the actual call site once the handler lands.