From dd32033657fc7d6a755c2feae1714148ee43fc7e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 12 Jul 2016 19:23:10 +0200 Subject: [PATCH] hydra-update-gc-roots: Only keep outputs when in direct mode This prevents the server from gradually filling up due to store paths fetched by hydra-server that then get turned into a GC root by hydra-update-gc-roots. --- src/script/hydra-update-gc-roots | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/script/hydra-update-gc-roots b/src/script/hydra-update-gc-roots index db46193a..5877a635 100755 --- a/src/script/hydra-update-gc-roots +++ b/src/script/hydra-update-gc-roots @@ -11,6 +11,7 @@ use Hydra::Model::DB; use POSIX qw(strftime); my $db = Hydra::Model::DB->new(); +my $config = getHydraConfig(); my %roots; @@ -37,7 +38,9 @@ sub keepBuild { $build->get_column('project'), ":", $build->get_column('jobset'), ":", $build->get_column('job'), "; ", $build->system, "; ", strftime("%Y-%m-%d %H:%M:%S", localtime($build->timestamp)), ")\n"; - if ($build->finished && ($build->buildstatus == 0 || $build->buildstatus == 6)) { + if (($config->{store_mode} // "direct") eq "direct" && + $build->finished && ($build->buildstatus == 0 || $build->buildstatus == 6)) + { foreach my $path (split / /, $build->get_column('outpaths')) { if (isValidPath($path)) { addRoot $path;