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:
authorSami Hiltunen <shiltunen@gitlab.com>2023-06-30 13:23:38 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2023-07-06 12:28:18 +0300
commit394939627d4b076db849d2bb0ff6f20929888193 (patch)
tree49c7bb8dfa860b63697a1ac3357f9ea2bfb385b4
parent31bc44153b3ae3c43b333efe251906cab1bfdc76 (diff)
Sync object pool removals
Object pool removals are currently not synced which may lead to them coming back in full or in a partial state after a crash. This commit adds the missing sync. Changelog: fixed
-rw-r--r--internal/git/objectpool/pool.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/git/objectpool/pool.go b/internal/git/objectpool/pool.go
index be2296c31..c924014e9 100644
--- a/internal/git/objectpool/pool.go
+++ b/internal/git/objectpool/pool.go
@@ -17,6 +17,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v16/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage"
"gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/transaction"
+ "gitlab.com/gitlab-org/gitaly/v16/internal/safe"
"gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb"
)
@@ -127,7 +128,15 @@ func (o *ObjectPool) Remove(ctx context.Context) (err error) {
return nil
}
- return os.RemoveAll(path)
+ if err := os.RemoveAll(path); err != nil {
+ return fmt.Errorf("remove all: %w", err)
+ }
+
+ if err := safe.NewSyncer().SyncParent(path); err != nil {
+ return fmt.Errorf("sync parent: %w", err)
+ }
+
+ return nil
}
// FromRepo returns an instance of ObjectPool that the repository points to