Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Newdigate <andrew@gitlab.com>2017-12-01 18:04:23 +0300
committerAndrew Newdigate <andrew@gitlab.com>2017-12-01 18:04:23 +0300
commit143c86e482617e934ae3ad522560564730b0de46 (patch)
tree91171c48833c5b38af907eb42059f12962516c6f
parentd88bfb7b328cacef19d77a6c07d76abe87243c6e (diff)
parent050e36a2d65fe43d13dd630875b380918567ed22 (diff)
Merge branch 'an/more-housekeeping-logging' into 'master'
Log more details in housekeeping See merge request gitlab-org/gitaly!435
-rw-r--r--CHANGELOG.md5
-rw-r--r--internal/helper/housekeeping/housekeeping.go22
2 files changed, 24 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 61d39a002..7f40669ea 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Gitaly changelog
+UNRELEASED
+
+- More logging in housekeeping
+ https://gitlab.com/gitlab-org/gitaly/merge_requests/435
+
v0.56.0
- Implement UserCherryPick RPC
diff --git a/internal/helper/housekeeping/housekeeping.go b/internal/helper/housekeeping/housekeeping.go
index 153443dbf..3dbd119da 100644
--- a/internal/helper/housekeeping/housekeeping.go
+++ b/internal/helper/housekeeping/housekeeping.go
@@ -7,6 +7,7 @@ import (
"time"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
+ log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
)
@@ -14,9 +15,12 @@ const deleteTempFilesOlderThanDuration = 7 * 24 * time.Hour
// Perform will perform housekeeping duties on a repository
func Perform(ctx context.Context, repoPath string) error {
- log := grpc_logrus.Extract(ctx)
+ logger := grpc_logrus.Extract(ctx).WithField("system", "housekeeping")
- return filepath.Walk(repoPath, func(path string, info os.FileInfo, err error) error {
+ filesMarkedForRemoval := 0
+ unremovableFiles := 0
+
+ err := filepath.Walk(repoPath, func(path string, info os.FileInfo, err error) error {
if repoPath == path {
// Never consider the root path
return nil
@@ -26,9 +30,12 @@ func Perform(ctx context.Context, repoPath string) error {
return nil
}
+ filesMarkedForRemoval++
+
err = forceRemove(path)
if err != nil {
- log.WithError(err).WithField("path", path).Warn("Unable to remove stray file")
+ unremovableFiles++
+ logger.WithError(err).WithField("path", path).Warn("unable to remove stray file")
}
if info.IsDir() {
@@ -38,6 +45,15 @@ func Perform(ctx context.Context, repoPath string) error {
return nil
})
+
+ if filesMarkedForRemoval > 0 {
+ logger.WithFields(log.Fields{
+ "files": filesMarkedForRemoval,
+ "failures": unremovableFiles,
+ }).Info("removed files")
+ }
+
+ return err
}
func fixPermissions(path string) {