Problem Description
The pvc-evictor's deleter process handles storage reclamation by executing batch file deletions of .bin cache files via xargs rm -f. While this successfully reclaims disk space (bytes/gigabytes), it leaves behind an abandoned directory tree.
Specifically, the nested subdirectories created by the FileMapper:
.../__r//_g<group_idx>/
remain on the disk even after all .bin files inside them are deleted.
Impact
Traversal Degradation: The pvc-evictor's crawler (and general filesystem operations) must traverse hundreds of thousands of empty folders, severely hurting performance to the point where the file discovery may not be able to keep up with new file creation.
Proposed Solution: Bottom-Up Empty Directory Cleanup
The deleter process should clean up empty directories immediately after a batch of files is successfully deleted. This should be done in a bottom-up fashion so that a leaf directory is cleaned first, followed by its parents if they also become empty.
That operation could be done as part of the deletion operation or as a separate process that is dedicated to cleaning up folders to minimize the impact on space reclamation speed.
Problem Description
The pvc-evictor's deleter process handles storage reclamation by executing batch file deletions of .bin cache files via xargs rm -f. While this successfully reclaims disk space (bytes/gigabytes), it leaves behind an abandoned directory tree.
Specifically, the nested subdirectories created by the FileMapper:
.../__r//_g<group_idx>/
remain on the disk even after all .bin files inside them are deleted.
Impact
Traversal Degradation: The pvc-evictor's crawler (and general filesystem operations) must traverse hundreds of thousands of empty folders, severely hurting performance to the point where the file discovery may not be able to keep up with new file creation.
Proposed Solution: Bottom-Up Empty Directory Cleanup
The deleter process should clean up empty directories immediately after a batch of files is successfully deleted. This should be done in a bottom-up fashion so that a leaf directory is cleaned first, followed by its parents if they also become empty.
That operation could be done as part of the deletion operation or as a separate process that is dedicated to cleaning up folders to minimize the impact on space reclamation speed.