diff options
author | Dan Fandrich <danf@mageia.org> | 2024-01-23 11:23:51 -0800 |
---|---|---|
committer | Dan Fandrich <danf@mageia.org> | 2024-01-23 12:10:16 -0800 |
commit | f7e017e88ba8be60385f289f3aa73fda26650f27 (patch) | |
tree | ab868d3b60eb72c6c4a18c14aa42149519731c79 /modules | |
parent | 4ea3c32245d86481002461cfc2d7c25b36447c67 (diff) | |
download | puppet-f7e017e8.tar puppet-f7e017e8.tar.gz puppet-f7e017e8.tar.bz2 puppet-f7e017e8.tar.xz puppet-f7e017e8.zip |
Add a pair of test jobs for clearing old schedbot packages
It's now confirmed that tidy() has been creating huge (2.6 GiB) state
files that the Puppet agent loads before every agent run, which causes
runs to take up to 4 days each and use of all RAM on the server.
Cleaning files using find is more straightforward and efficient and
avoids this problem.
The tidy() functions are disabled here and the cron jobs aren't actually
deleting files yet, so a follow-up commit will enable deleting
imminently, once testing shows it will work.
Follow-up to 59d57245
Diffstat (limited to 'modules')
-rw-r--r-- | modules/buildsystem/manifests/scheduler.pp | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/modules/buildsystem/manifests/scheduler.pp b/modules/buildsystem/manifests/scheduler.pp index 9848f109..cacae1e7 100644 --- a/modules/buildsystem/manifests/scheduler.pp +++ b/modules/buildsystem/manifests/scheduler.pp @@ -25,28 +25,48 @@ class buildsystem::scheduler { } if ($buildsystem::var::scheduler::clean_uploads_logs_age != '0') { - tidy { "${buildsystem::var::scheduler::homedir}/uploads": - type => 'ctime', - recurse => true, - age => $buildsystem::var::scheduler::clean_uploads_logs_age, - rmdirs => true, - } +# tidy { "${buildsystem::var::scheduler::homedir}/uploads": +# type => 'ctime', +# recurse => true, +# age => $buildsystem::var::scheduler::clean_uploads_logs_age, +# rmdirs => true, +# } cron { 'clean uploads logs': user => $login, - # TEMPORARY to test what be deleted before replacing the above - command => sprintf("/usr/bin/find %s/uploads -xdev -type f -mtime +14 >/var/lib/schedbot/clean-uploads-logs-test.log", shellquote(${buildsystem::var::scheduler::homedir})), - hour => '*/4', + # TEMPORARY to test what will be deleted before replacing the above + command => sprintf("/usr/bin/find %s/uploads -xdev -depth -type f -ctime +14 >/var/lib/schedbot/clean-uploads-logs-test.log 2>&1", shellquote($homedir)), + hour => '*/1', minute => '51', } + cron { 'clean uploads dirs': + user => $login, + # TEMPORARY to test what will be deleted before replacing the above + # Remove old empty directories. This will take several passes over + # several weeks to delete a directory hierarchy because it is looking + # at ctime instead of mtime, which resets every time a file/directory + # underneath it is deleted. Directories don't take much space, so this + # shouldn't be a real issue. + command => sprintf("/usr/bin/find %s/uploads -ignore_readdir_race -xdev -depth -type d -ctime +14 -empty >/var/lib/schedbot/clean-uploads-dirs-test.log 2>&1", shellquote($homedir)), + hour => '*/1', + minute => '53', + } } if ($buildsystem::var::scheduler::clean_uploads_packages_age != '0') { - tidy { "${buildsystem::var::scheduler::homedir}/uploads/**/*.rpm": - path => "${buildsystem::var::scheduler::homedir}/uploads", - type => 'ctime', - recurse => true, - age => $buildsystem::var::scheduler::clean_uploads_packages_age, - matches => [ '*.rpm' ], +# tidy { "${buildsystem::var::scheduler::homedir}/uploads/**/*.rpm": +# path => "${buildsystem::var::scheduler::homedir}/uploads", +# type => 'ctime', +# recurse => true, +# age => $buildsystem::var::scheduler::clean_uploads_packages_age, +# matches => [ '*.rpm' ], +# } + + cron { 'clean uploads packages': + user => $login, + # TEMPORARY to test what will be deleted before replacing the above + command => sprintf("/usr/bin/find %s/uploads -xdev -depth -type f -name '*.rpm' -ctime +7 >/var/lib/schedbot/clean-uploads-packages-test.log 2>&1", shellquote($homedir)), + hour => '*/1', + minute => '52', } } } |