zhoulii opened a new issue, #6180: URL: https://github.com/apache/paimon/issues/6180
### Search before asking - [x] I searched in the [issues](https://github.com/apache/paimon/issues) and found nothing similar. ### Motivation When `snapshot.clean-empty-directories` is set to its default value (false), expired snapshots do not clean up empty directories after data files are deleted. This behavior is expected and is by design. However, this may leads to an accumulation of a large number of empty directories over time. The LocalOrphanFilesClean utility is expected to handle such leftover files and directories. But it appears that LocalOrphanFilesClean only attempts to delete an empty directory if it has just deleted one or more files within that same directory. As a result, the pre-existing empty directories, which were left behind by previous snapshot expirations, are never identified or cleaned up by LocalOrphanFilesClean. ### Solution clean up the pre-existing empty directories when getting candidate deleting files. ### Anything else? _No response_ ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
