Fix stale parent directory sizes after subtree reindex#354
Open
wangruohui wants to merge 4 commits intozevv:masterfrom
Open
Fix stale parent directory sizes after subtree reindex#354wangruohui wants to merge 4 commits intozevv:masterfrom
wangruohui wants to merge 4 commits intozevv:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes stale cached directory sizes when reindexing a subtree by propagating updated subtree sizes into ancestor serialized directory buffers, keeping parent views consistent without a full reindex.
Changes:
- Add helpers to split a path into parent/child and to update a child directory entry inside a parent directory buffer.
- After writing a refreshed subtree report, update the immediate parent entry (exact size + devino) and propagate size deltas up ancestor buffers.
- Hook the propagation into
duc_index()afterdb_write_report().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR fixes a stale-cache issue in
ducwhen reindexing a subtree.Previously, if a user indexed
a, then later modified files undera/band randuc index a/b, the subtree report fora/bwas refreshed, but the cached directory entry stored inawas not. As a result, commands likeduc ui aorduc ls acould still show the old size forb.Root Cause
ducstores directory listings as serialized per-directory buffers, and parent directories cache the size of each child directory entry. Reindexing a subtree updated:but it did not propagate the new size back into ancestor directory buffers.
That meant readers opening
astill saw the old cached size forb.Changes
This PR adds parent-buffer propagation after writing a refreshed subtree report:
devinoThis keeps cached parent views consistent after
duc index <subtree>without forcing a full reindex of the ancestor tree.Example
Before this change:
duc index aa/bduc index a/bduc ui abcould still show the old size insidea.After this change,
bis updated correctly in the parent view.