action #59103

Remove CURRENT repositories that are older than a month

Added by coolo 5 months ago. Updated 4 months ago.

Status:ResolvedStart date:05/11/2019
Priority:NormalDue date:
Assignee:cdywan% Done:

0%

Category:Feature requests
Target version:Current Sprint
Difficulty:easy
Duration:

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.


Related issues

Related to openQA Project - action #59008: 900GB of assets not tracked ('other' assets?) Resolved 04/11/2019
Related to openQA Project - action #59888: Take directory mtime of assets into account Resolved 15/11/2019

History

#1 Updated by cdywan 5 months ago

  • Related to action #59008: 900GB of assets not tracked ('other' assets?) added

#2 Updated by cdywan 5 months ago

  • Status changed from New to In Progress
  • Assignee set to cdywan
  • Target version changed from Ready to Current Sprint

#3 Updated by andriinikitin 5 months 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.

#4 Updated by coolo 5 months 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 :)

#5 Updated by cdywan 5 months 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.

#6 Updated by coolo 5 months 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.

#7 Updated by coolo 5 months ago

... and you will end in a very overengineed setup to save 5 lines of code.

#8 Updated by cdywan 5 months 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.

#9 Updated by cdywan 5 months ago

  • Related to action #59888: Take directory mtime of assets into account added

#10 Updated by okurz 4 months 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/".

Also available in: Atom PDF