Expose API to manually trigger cancellation#959
Merged
Conversation
✅ Deploy Preview for salsa-rs canceled.
|
CodSpeed Performance ReportMerging #959 will not alter performanceComparing Summary
|
Veykril
reviewed
Aug 3, 2025
| /// If you invoke it while a snapshot exists, it | ||
| /// will block until that snapshot is dropped -- if that snapshot | ||
| /// is owned by the current thread, this could trigger deadlock. | ||
| #[cfg(feature = "salsa_unstable")] |
Member
There was a problem hiding this comment.
I think it's fine to commit this as stable API. It seems generally useful to me to be able to trigger cancellation without bumping the revision or triggering LRU garbage collection.
Also not like salsa's API is generally stable right now (as is evident by me having removed that function 🙈)
Veykril
approved these changes
Aug 3, 2025
1378f67 to
b2cc5a1
Compare
Merged
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.
We (ty) use the salsa database to enforce exclusive ownership
of
Arcs. These may or may not be stored in the salsa database (we'll do a regularset_inputif they're stored in the db).The way this is implemented is that we call
as_dyn_database_mut().zalsa_mut()before unwrapping the
Arc. This allows us to avoid copying potentially large data structures.However, 211bc15#r163337827 removed
as_dyn_database_mut.Ideally, Salsa would have a dedicated feature for Arcs like this. For now, I suggest
Adding a method that triggers cancellation without bumping the revision.
Previous discussion https://salsa.zulipchat.com/#narrow/stream/333573-salsa-3.2E0/topic/Expose.20an.20API.20to.20cancel.20other.20queries