Skip to content

cache/disk: census counts an eviction as never-read from its access state, so boot-scanned entries stop inflating evicted_never_read after a restart - #71

Merged
shreyas-blacksmith merged 3 commits into
patchsetfrom
devin/1793631618-evicted-never-read-access-state
Nov 2, 2026
Merged

shreyas-blacksmith merged 3 commits into
patchsetfrom
devin/1793631618-evicted-never-read-access-state

Conversation

@shreyas-blacksmith

@shreyas-blacksmith shreyas-blacksmith commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

censusRecorder.OnEvict derived neverRead from lastAccess == addedAt. The boot scan seeds every existing file with addedAt == lastAccess (file mtime; atime is frozen at creation on noatime mounts) and accessState = itemStateBootScanned, so after a restart every eviction of an untouched pre-existing object counted as never-read: on prod, 13 of 13 evicting tenants showed 100% evicted-unread since the .16 roll. The per-class array already used the access state; the eviction accounting now switches on it:

switch value.accessState {
case itemStateNew:          // written this process, never hit
    acc.evictedNeverReadByes += size
case itemStateTouched:      // lastAccess is a real hit
    evictedLiveBytes / evictedByLastReadAge[...]
// itemStateBootScanned: no read history either way
}

Boot-scanned evictions still count in evicted_bytes, evicted_entries and the created-age histogram; they no longer appear as never-read (scalar + bazel_remote_disk_cache_evicted_never_read_{bytes,entries} counters) nor as recently read (evicted_live_bytes, last-read buckets), since the only timestamp they carry is file metadata. TestCensusBootScannedIsUnknownNotNeverRead asserts all of it alongside the class array.

Link to Devin session: https://app.devin.ai/sessions/df6c6655558146b9bafe936b062e49e7
Open in Devin Desktop: https://app.devin.ai/desktop/session/df6c6655558146b9bafe936b062e49e7?variant=devin
Requested by: @shreyas-blacksmith


View with [code]smith See it in action
Need help on this PR? Tag @codesmith-bot with what you need.


View with [code]smith View full Proof
Need help on this PR? Tag @codesmith-bot with what you need. (Staging)

…tate, so boot-scanned entries stop inflating evicted_never_read after a restart

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@blacksmith-staging

blacksmith-staging Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Matches Restart: boot-scanned evictions not never-read

After a restart, evicting the 10 untouched boot-scanned blobs no longer counts as never-read in the census row or the Prometheus counters. evicted_bytes still counts them.

Merge-base

Never-read after restart

This PR 181fdc42

Never-read after restart

Also checked · 3 match

Matches Runtime unread evictions still never-read
Matches No read history claimed for boot-scanned
Matches Read entries still count as last-read

Proof on 181fdc42 (from 7d9ab6ea) · Did Proof get it right? Yes · No

View full Proof report

shreyas-blacksmith and others added 2 commits November 2, 2026 15:08
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@shreyas-blacksmith
shreyas-blacksmith merged commit b8752bb into patchset Nov 2, 2026
6 checks passed
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.

1 participant