Skip to content

Expand missing prefetch mitigation usage#1905

Open
tyrielv wants to merge 5 commits intomicrosoft:masterfrom
tyrielv:tyrielv/extend-prefetch-mitigation
Open

Expand missing prefetch mitigation usage#1905
tyrielv wants to merge 5 commits intomicrosoft:masterfrom
tyrielv:tyrielv/extend-prefetch-mitigation

Conversation

@tyrielv
Copy link
Contributor

@tyrielv tyrielv commented Feb 24, 2026

Currently, the mitigation to download commit packs when we encounter missing trees during git operations only applies if PrefetchHasBeenDone() is false.

This means that if cache servers are not providing the full up-to-date commit graph we won't apply the mitigation.

  • Remove PrefetchHasBeenDone() check from ShouldDownloadCommitPack and UpdateTreesForDownloadedCommits so the commit pack download mitigation applies regardless of whether prefetch has been done, protecting against cases where prefetch pack cache servers are not up-to-date.
  • Add MissingTreeTracker to GVFS.Common, which keeps track of how many missing trees have been detected for recent commits downloaded as loose objects.
  • Replace Dictionary<string, string> treesWithDownloadedCommits in InProcessMount with MissingTreeTracker capped at 20 commits to prevent unbounded growth since we are no longer limiting to only the period before first prefetch

Currently, the mitigation to download commit packs when we encounter
missing trees during git history traversal only applies if
PrefetchHasBeenDone() is false.

This means that if cache servers are not providing the full up-to-date
commit graph we won't apply the mitigation.

- Remove PrefetchHasBeenDone() check from ShouldDownloadCommitPack and
  UpdateTreesForDownloadedCommits so the commit pack download mitigation
  applies regardless of whether prefetch has been done, protecting
  against cases where prefetch pack cache servers are not up-to-date.
- Add LruCache<TKey, TValue> to GVFS.Common
- Replace Dictionary<string, string> treesWithDownloadedCommits in
  InProcessMount with LruCache capped at 4000 (10 times the threshold
  per commit pack) entries to prevent unbounded growth since we are no
  longer limiting to only the period before first prefetch
@tyrielv
Copy link
Contributor Author

tyrielv commented Feb 25, 2026

Thought: A dedicated class for handling this caching could pull more of the logic into it than the LruCache currently has. The LruCache is using LRU on the tree level, but it would make more sense for it to be on the commit level.

@tyrielv
Copy link
Contributor Author

tyrielv commented Feb 26, 2026

Thought: A dedicated class for handling this caching could pull more of the logic into it than the LruCache currently has. The LruCache is using LRU on the tree level, but it would make more sense for it to be on the commit level.

I implemented this.

@tyrielv tyrielv force-pushed the tyrielv/extend-prefetch-mitigation branch from 73581bf to a90175f Compare February 26, 2026 19:33
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