Shaman: better logging for garbage collector

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.
This commit is contained in:
Sybren A. Stüvel 2022-07-25 12:26:20 +02:00
parent 9856a34071
commit 6731f96579

View File

@ -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 {