-
Notifications
You must be signed in to change notification settings - Fork 638
Extract the preprocessor cache out from disk cache #2571
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
Open
xis19
wants to merge
17
commits into
mozilla:main
Choose a base branch
from
xis19:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b06eea6
Extract LazyDiskCache to a separated file
xis19 2737c9a
Extract FileObjectSource, CacheRead and CacheWrite to cache_io.rs
xis19 4754ed7
Extract cache::normalize_key to cache::utils::normalize_key
xis19 e368015
Move PreprocessorCacheModeConfig to src/config.rs
xis19 574b625
Split Storage trait into Storage and PreprocessorCacheStorage traits
xis19 ea173bf
Refactor get_storage into multiple functions for readability
xis19 76acb9f
fixup! Remove redundant use
xis19 ccfa7ed
fixup! Run rustfmt on the source code
xis19 861cb65
Move Storage implementation for opendal::Operator to storage.rs
xis19 9cd04cc
fixup! If preprocessor cache directory is not set, use ${disk cache d…
xis19 8d12864
fixup! Fix the test issues
xis19 267f695
fixup! If preprocessor cache directory is not set, use ${disk cache d…
xis19 3b2b880
Update documentations
xis19 f01669b
DebugPreprocessorCache command line option should use preprocessor ca…
xis19 70afb93
Additional documentation about preprocessor cache
xis19 e928030
fixup! Fix the test failures
xis19 f07942e
fixup! rustfmt
xis19 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
Oops, something went wrong.
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.
That's not true anymore, is it? Other information in this PR indicates that maybe it'll work with caches other than local disk as long as they support random seeks - but in any case, now it always is local disk? (That's somewhat contradictory, so please make it consistent)
I am also still wondering if requiring random seek capability is very important or if it just saved three lines of code somewhere and the requirement could be lifted. Well, that's an optional improvement.
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.
Based on my experience, random write is definitely required. To create a shared cache for our team, I tried to use mountpoint-s3 to mount a S3 bucket to $HOME/.cache/sccache. What I have observed is that, if preprocessor cache is enabled, mountpoint-s3 would fail because it does not support random write. This implies that somewhere in the sccache code, random write is being used. This is the motivation I decided to extract preprocessor cache out from disk cache.
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.
My question is not if random writes are used, but if the random writes are fundamentally necessary or a sort of frivolous requirement that could be easily lifted. You don't want to write hundreds of lines of code to work around a tiny problem that you could just fix instead.
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.
Note, making the preprocessor cache compatible with sequential-only devices wouldn't make it useless to have a feature to split the caches: the preprocessor cache is smaller than the main cache and especially benefits from fast storage, which would be reasons to keep it on a local SSD.
Uh oh!
There was an error while loading. Please reload this page.
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.
TBH I did not read the lru code before. Digging into the details makes feel it does not need random write feature. However, it was observed that mountpoint-s3 complains it does not support random write. Not sure if I want to dig into that project at this time though. I do not understand why this happens. My best guess at this stage is that, the LRU cache does some kind of random write (together with the tempfile), and it is done somewhere outside the current code, maybe inside some Rust internal implementation details.
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.
OK, that just leaves adapting the documentation to the new (potentially) split caches reality as a thing to do.