Skip to content

gc: get_registry_items_to_clean_size_both can orphan src directories #13063

Open
@ehuss

Description

@ehuss

The function GlobalCacheTracker::get_registry_items_to_clean_size_both is responsible for manual gc cleaning when the --max-download-size option is specified. When determining what to delete, it scans both the src and .crate files.

An issue is that if it deletes a .crate file without deleting its corresponding src directory, the src directory becomes orphaned and unusuable, which results in a waste of disk space. Eventually it will be reclaimed during future cache cleaning. It would be nice if it made sure that the src gets removed if a .crate file is removed. However, this might be difficult to implement and not worth the complexity, so I'm not sure if this should be done or not.

This may not happen in practice due to the way sorting works (generally the src and .crate should have the same timestamp, and it should sort the src before the .crate). If that's the case, then this issue can probably be closed (and remove the TODO comment in the code).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-lowPriority: LowS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Z-gcNightly: garbage collection

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions