action #59103
closedRemove CURRENT repositories that are older than a month
0%
Description
limit_assets ignores CURRENT links, but we shouldn't leave them old. If they are no longer current (if we stop syncing the project), limit_assets should remove it as well.
Updated by livdywan over 5 years ago
- Related to action #59008: 900GB of assets not tracked ('other' assets?) added
Updated by livdywan over 5 years ago
- Status changed from New to In Progress
- Assignee set to livdywan
- Target version changed from Ready to Current Sprint
Updated by andriinikitin over 5 years ago
Sorry I had to mention that I did remove these files few days ago with commands below (reviewing the list in between):
find /var/lib/openqa/share/factory/repo/ -maxdepth 1 -name "*CURRENT*" -type d -mtime +30 -exec ls -d {}/ \; >> list.txt
( set -x; while read in; do rm -r "$in"; sleep 2; done < list.txt )
It did free up ~70G. The list can be found at /home/anikitin/list.txt on osd.
But the ticket may still need to create a cron job which will do remove outdated folders daily.
Updated by coolo over 5 years ago
as long as we have special case for CURRENT in the code, we can extend it. In the latest PR, Christian removed the special case, but it's unclear what his suggested replacement is. So in doubt we need said systemd timer (forget about cron :)
Updated by livdywan over 5 years ago
coolo wrote:
as long as we have special case for CURRENT in the code, we can extend it. In the latest PR, Christian removed the special case, but it's unclear what his suggested replacement is. So in doubt we need said systemd timer (forget about cron :)
Right. I removed the special case of never ever deleting things with CURRENT in the name. Instead CURRENT repos would be deleted every 14 days like all other assets.
My idea was to also look into a configurable limit like we have for the audit log, e.g having something like this:
[assets/storage_duration]
# Retain CURRENT repos for a month
CURRENT = 30
The keys here would be regular expressions based on the basename, given a time in days, overriding the default for untracked assets.
We could also add things here which we want gone asap or never, if it's useful.
Updated by coolo over 5 years ago
CURRENT repos would be deleted every 14 days like all other assets.
Where do you take that from? untracked assets are deleted X days after their creation time (where X is 2 for osd) - and it would mean we need to resync CURRENT every 2nd day. So extending this X for specific regexps might be a step, but you also need to take the mtime of the repo into account.
Updated by coolo over 5 years ago
... and you will end in a very overengineed setup to save 5 lines of code.
Updated by livdywan over 5 years ago
coolo wrote:
CURRENT repos would be deleted every 14 days like all other assets.
Where do you take that from? untracked assets are deleted X days after their creation time (where X is 2 for osd) - and it would mean we need to resync CURRENT every 2nd day. So extending this X for specific regexps might be a step, but you also need to take the mtime of the repo into account.
Sorry, "every 14 days" is the default. Scratch the number from that sentence.
... and you will end in a very overengineed setup to save 5 lines of code.
Right now those lines ensure that the repos are never cleared. So I had to remove them anyway. Might as well add 5 lines to the correct class which can be configured.
Updated by livdywan over 5 years ago
- Related to action #59888: Take directory mtime of assets into account added
Updated by okurz about 5 years ago
- Status changed from In Progress to Resolved
Checking osd:/var/lib/openqa/share/factory/repo I can see that there are "CURRENT" repos but they are not old so this seems to work. https://openqa.suse.de/admin/assets shows "CURRENT" tracked as well as assets in "other/".