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-05-27 17:01:11 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2023-07-13 10:38:12 +0300
commitaef5af394d8152af5b4c494ab8021e914624c937 (patch)
tree55acb089e2ba596ef381cf40eaaac1a3e48a1db4
parent80b3e17acbfbcdb0038375967468e4088a8fcb4f (diff)
Unconditionally setup a staging repository
We're currently setting up the staging repository when we are about to commit a transaction. Staging repository is essentially the target repository with the transaction's quarantine directory applied. We're looking to automatically quarantine the repositroy for the RPC handlers and returning the details how to access a repository from the transaction to make integration easier. To facilitate that, setup the staging repository already on transaction beginning. We can then use it later rewrite the request's repository.
-rw-r--r--internal/gitaly/storage/storagemgr/transaction_manager.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/gitaly/storage/storagemgr/transaction_manager.go b/internal/gitaly/storage/storagemgr/transaction_manager.go
index 6375b1978..9eeeb97d5 100644
--- a/internal/gitaly/storage/storagemgr/transaction_manager.go
+++ b/internal/gitaly/storage/storagemgr/transaction_manager.go
@@ -283,6 +283,10 @@ func (mgr *TransactionManager) Begin(ctx context.Context) (_ *Transaction, retur
return nil, fmt.Errorf("create quarantine directory: %w", err)
}
+ if err := mgr.setupStagingRepository(ctx, txn); err != nil {
+ return nil, fmt.Errorf("setup staging repository: %w", err)
+ }
+
return txn, nil
}
}
@@ -537,10 +541,6 @@ type resultChannel chan error
func (mgr *TransactionManager) commit(ctx context.Context, transaction *Transaction) error {
transaction.result = make(resultChannel, 1)
- if err := mgr.setupStagingRepository(ctx, transaction); err != nil {
- return fmt.Errorf("setup staging repository: %w", err)
- }
-
if err := mgr.stageHooks(ctx, transaction); err != nil {
return fmt.Errorf("stage hooks: %w", err)
}