Skip to content
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

Allow triggering LRU eviction without increasing the current revision #685

Merged
merged 6 commits into from
Feb 20, 2025

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Feb 12, 2025

Best reviewed by commit as it contains a couple cleanup commits

Copy link

netlify bot commented Feb 12, 2025

Deploy Preview for salsa-rs canceled.

Name Link
🔨 Latest commit 2927a4a
🔍 Latest deploy log https://app.netlify.com/sites/salsa-rs/deploys/67b7306ccd76d50008c13640

Copy link

codspeed-hq bot commented Feb 12, 2025

CodSpeed Performance Report

Merging #685 will not alter performance

Comparing Veykril:veykril/push-lzwyywmqwmuk (2927a4a) with master (198db98)

Summary

✅ 9 untouched benchmarks

@Veykril Veykril force-pushed the veykril/push-lzwyywmqwmuk branch 2 times, most recently from da47143 to 077978d Compare February 12, 2025 11:39
@Veykril Veykril changed the title Allow trigger LRU eviction without increasing the current revision Allow triggering LRU eviction without increasing the current revision Feb 12, 2025
@Veykril Veykril force-pushed the veykril/push-lzwyywmqwmuk branch from e3cdab6 to 8c83055 Compare February 12, 2025 13:05
Comment on lines +294 to +293
/// Sets the lru capacity
///
/// **WARNING:** Just like an ordinary write, this method triggers
/// cancellation. 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.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit iffy about how our cancellation triggering functions all need this comment. I wonder if it would make sense to introduce a CancellationToken type (not to be confused with async cancellation tokens...) that one would need to supply to acknowledge the deadlock conditions as such an API forces the caller to think about this, where as the current status quo is having to have read the docs of the function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry that a CancellationToken would be annoying because you'd have to pass it to every function taking a &mut db.

It would be nice if our concurrent db design wouldn't even permit having multiple &mut db checkers by relying on the borrow checker.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that would infest all the input setters I believe hmm

@Veykril Veykril force-pushed the veykril/push-lzwyywmqwmuk branch from 8c83055 to eec8181 Compare February 17, 2025 12:50
@Veykril Veykril force-pushed the veykril/push-lzwyywmqwmuk branch from eec8181 to 2927a4a Compare February 20, 2025 13:38
Copy link
Member

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok-- I don't entirely understand the point of this, but I trust you

src/zalsa.rs Outdated
@@ -45,6 +45,8 @@ pub unsafe trait ZalsaDatabase: Any {
///
/// **WARNING:** Triggers cancellation to other database handles.
/// This can lead to deadlock!
///
/// Note that this needs to be paired with a call to `Zalsa::new_revision` or `Zalsa::clear_cancellation_flag`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment I think is on the wrong commit?

@nikomatsakis nikomatsakis added this pull request to the merge queue Feb 20, 2025
Merged via the queue into salsa-rs:master with commit c8826fa Feb 20, 2025
10 checks passed
@Veykril Veykril deleted the veykril/push-lzwyywmqwmuk branch February 20, 2025 21:30
@Veykril
Copy link
Member Author

Veykril commented Feb 20, 2025

In r-a we basically want to trigger LRU if no cancellation have occurred for some while as the LRU won't trigger if no inputs change anymore, this gives us the flexibility to do that

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