From 6731f965794a2f369915048e33a3e102c58b411b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 25 Jul 2022 12:26:20 +0200 Subject: [PATCH] Shaman: better logging for garbage collector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Increase verbosity (debug → info) when checkout dir traversal fails, and add a trace-level log for each file that is still in use. There were some issues with symlinks, where the wrong paths were compared (see T99965) and this log made it visible what was going wrong. --- pkg/shaman/cleanup.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/shaman/cleanup.go b/pkg/shaman/cleanup.go index c37481df..dfcdaecc 100644 --- a/pkg/shaman/cleanup.go +++ b/pkg/shaman/cleanup.go @@ -189,7 +189,7 @@ func (s *Server) gcFilterLinkedFiles(checkoutPath string, oldFiles mtimeMap, log } if err != nil { - logger.Debug().Err(err).Msg("error while walking checkout path while searching for symlinks") + logger.Info().Err(err).Msg("error while walking checkout path while searching for symlinks") return err } if info.IsDir() || info.Mode()&os.ModeSymlink == 0 { @@ -214,6 +214,7 @@ func (s *Server) gcFilterLinkedFiles(checkoutPath string, oldFiles mtimeMap, log // Delete the link target from the old files, if it was there at all. delete(oldFiles, linkTarget) + logger.Trace().Str("path", linkTarget).Msg("shaman: file is in use, should not be garbage-collected") return nil } if err := filepath.Walk(checkoutPath, visit); err != nil {