-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[ENH]: Propagate cancellations to NAC queue #5129
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
base: graphite-base/5129
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
Propagate Cancellations to NAC Queue and Improve Priority Management This PR introduces substantial changes to the admission control (NAC) layer for S3-backed storage. Cancellations of in-flight NAC requests are now properly propagated, so when a future is dropped (i.e., caller cancels or times out), its associated priority is removed from the pending request's priority counters. The handling of priorities has been overhauled: rather than a single binary priority flag, a thread-safe set of per-level counters (PriorityHolder) now tracks how many outstanding tasks require each priority level. This allows the effective priority of a request to be dynamically lowered if all high-priority waiters are cancelled. The refactor introduces several new types (e.g., PriorityHolder, RollbackPriorityOnDrop), modifies all relevant internal APIs to use them, and consistently updates the codebase to maintain correct lock and notification semantics. Key Changes• Replaced atomic priority flag with a PriorityHolder struct using atomic counters for each priority level. Affected Areas• rust/storage/src/admissioncontrolleds3.rs This summary was automatically generated by @propel-code-bot |
074d5a5
to
fa0aa59
Compare
let current_priority: StorageRequestPriority = current_priority.into(); | ||
// Unwrap shouldn't fail here as update_priority should have been called before | ||
// entering this. | ||
let current_priority = priority.get_priority().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.
[BestPractice]
Inconsistent error handling: The unwrap()
call on line 717 could cause a panic if get_priority()
returns None
. While the comment suggests this shouldn't happen, defensive programming would handle this case gracefully.
let current_priority = priority.get_priority().unwrap(); | |
let current_priority = match priority.get_priority() { | |
Some(pri) => pri, | |
None => { | |
tracing::error!("Priority holder has no active priorities during acquire"); | |
return self.remaining_tokens[StorageRequestPriority::lowest().as_usize()] | |
.acquire() | |
.await | |
.expect("Failed to acquire semaphore token"); | |
} | |
}; |
⚡ Committable suggestion
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
Description of changes
Summarize the changes made by this PR.
Test plan
How are these changes tested?
pytest
for python,yarn test
for js,cargo test
for rustMigration plan
N/A
Observability plan
It would be a good idea to add a metric that tracks the number of total waiters on the NAC layer.
Documentation Changes
Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?