Skip to content

Conversation

@loewenheim
Copy link
Contributor

@loewenheim loewenheim commented Feb 11, 2025

This attaches an (optional) metadata struct to cache entries produced by compute_memoized. For now, this structure contains two pieces of data:

  1. The scope (project ID or "global") of the request.
  2. The creation time of the entry.

We may add more in the future.

We don't currently write or read the metadata at any point. When we create a MdCacheEntry we use the without_md constructor, and when we consume one, we always use contents() or into_contents() to get the data. Actually using the metadata is left for a future PR.

ETA: After discussion, this now also renames the former CacheEntry to CacheContents and uses the name CacheEntry for the new "cache contents + metadata" struct.

@loewenheim loewenheim self-assigned this Feb 11, 2025
@loewenheim loewenheim requested a review from a team February 11, 2025 11:46

/// A cache entry with optional metadata.
#[derive(Debug, Clone)]
pub struct MdCacheEntry<T> {
Copy link
Member

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?

Copy link
Member

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 {
Copy link
Member

@jjbayer jjbayer Feb 11, 2025

Choose a reason for hiding this comment

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

nit

Suggested change
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> {
Copy link
Member

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.

@loewenheim
Copy link
Contributor Author

Thanks for the feedback, will rename.

@loewenheim loewenheim merged commit 450f1d6 into master Feb 12, 2025
16 checks passed
@loewenheim loewenheim deleted the feat/metadata branch February 12, 2025 09:56
loewenheim added a commit that referenced this pull request Feb 18, 2025
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.
loewenheim added a commit that referenced this pull request Feb 19, 2025
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.
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.

5 participants