-
-
Notifications
You must be signed in to change notification settings - Fork 60
feat: Add metadata to cache entries #1617
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
Conversation
|
|
||
| /// A cache entry with optional metadata. | ||
| #[derive(Debug, Clone)] | ||
| pub struct MdCacheEntry<T> { |
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.
nit: Md might confuse readers, should we call this CacheEntry and the original CacheEntry CacheContents or similar?
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.
I had the exact same thought, CacheEntry -> CacheContents and MdCacheEntry -> CacheEntry.
|
|
||
| impl<T> MdCacheEntry<T> { | ||
| /// Create a cache entry without attached metadata. | ||
| pub(crate) fn without_md(contents: CacheEntry<T>) -> Self { |
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.
nit
| pub(crate) fn without_md(contents: CacheEntry<T>) -> Self { | |
| pub(crate) fn without_metadata(contents: CacheEntry<T>) -> Self { |
|
|
||
| /// A cache entry with optional metadata. | ||
| #[derive(Debug, Clone)] | ||
| pub struct MdCacheEntry<T> { |
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.
I had the exact same thought, CacheEntry -> CacheContents and MdCacheEntry -> CacheEntry.
|
Thanks for the feedback, will rename. |
This adds functionality to write and read the metadata structures introduced in #1617 to and from the filesystem. A cache file's metadata file has the same path, but with the extension `.metadata`. The read happens in check_expiry, which gives the cleanup job access to the metadata. All of the old logic is still there—if no metadata file exists, we use the mtime from the FS as before. The write happens in compute. It should be noted that currently metadata are not propagated through the shared cache; this is left as future work.
This adds a setting retry_missing_after_public to downloaded and derived cache configs. The effect of this setting is to control the time after which negative (missing, failed download, &c.) cache entries from public sources. Whether a file comes from a public source is determined by reading its metadata, which we added in #1617 and started writing in #1618. The default value for this setting is 24h. This means that each Symbolicator only makes one request per day to public symbol sources for each missing debug file, as opposed to one per hour like before.
This attaches an (optional) metadata struct to cache entries produced by
compute_memoized. For now, this structure contains two pieces of data:We may add more in the future.
We don't currently write or read the metadata at any point. When we create a
MdCacheEntrywe use thewithout_mdconstructor, and when we consume one, we always usecontents()orinto_contents()to get the data. Actually using the metadata is left for a future PR.ETA: After discussion, this now also renames the former
CacheEntrytoCacheContentsand uses the nameCacheEntryfor the new "cache contents + metadata" struct.