fix: clean up staging ODB after dvc add --out transfer#11008
Open
BALOGUN-DAVID wants to merge 1 commit intotreeverse:mainfrom
Open
fix: clean up staging ODB after dvc add --out transfer#11008BALOGUN-DAVID wants to merge 1 commit intotreeverse:mainfrom
dvc add --out transfer#11008BALOGUN-DAVID wants to merge 1 commit intotreeverse:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11008 +/- ##
==========================================
+ Coverage 90.68% 90.98% +0.30%
==========================================
Files 504 505 +1
Lines 39795 41111 +1316
Branches 3141 3258 +117
==========================================
+ Hits 36087 37404 +1317
- Misses 3042 3069 +27
+ Partials 666 638 -28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Author
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.
Fix Staging ODB Cleanup for
dvc add --out📝 Description
When running
dvc add --out, DVC copies source files into the cache via a staging mechanism but fails to clean up the temporary staging ODB (stored inmemfs) and temporary upload files after the transfer completes.This causes lingering temporary files and
memfsbloat.This issue was confirmed as a bug by DVC maintainers.
Approach:
This PR adds a
staging.clear()call inside theOutput.transfer()method indvc/output.py, directly afterotransfer()successfully moves the objects from the staging area to the cache ODB.Impact:
Prevents memory leaks and disk space accumulation by properly freeing up temporary
memfsstaging files and caching artifacts upon successful completion of thedvc add --outcommand.✅ Test Results
test_add_with_out_cleans_up_stagingintests/func/test_add.pythat uses amockerspy onObjectDB.clearto ensure the cleanup function is triggered.add --outpass smoothly (e.g.,test_add_with_out,test_add_force_overwrite_out,test_add_to_cache_different_name).🧩 Visual Evidence —
output.pyChanges🧪 Visual Evidence — Test Changes
📋 Checklist
[x ] ❗ I have followed the Contributing to DVC checklist.
📖 If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
Thank you for the contribution - we'll try to review it as soon as possible. 🙏