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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-01-28 15:28:01 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-02-01 12:11:53 +0300
commit7b2e1a72457e8224670feb80d0402a6387bb0f01 (patch)
tree35d80f803bf4b1a0ec677e8cc1e04200fb4b8de2
parent0d8e8d6873722723e085d94af57778674db5f46f (diff)
transactions: Log transaction ID if transaction was not found
When a node casts a vote on a transaction, then it needs to pass the identifier of the transaction in order to identify it. If it is not possible to find a transaction for this ID, then we have to return an error. This error doesn't currently include the transaction ID, which makes it quite hard to correlate the error with other ongoing requests. Fix this by including the ID in the error message.
-rw-r--r--internal/praefect/transactions/manager.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/praefect/transactions/manager.go b/internal/praefect/transactions/manager.go
index 7c3572887..d77aa5ec3 100644
--- a/internal/praefect/transactions/manager.go
+++ b/internal/praefect/transactions/manager.go
@@ -199,7 +199,7 @@ func (mgr *Manager) voteTransaction(ctx context.Context, transactionID uint64, n
mgr.lock.Unlock()
if !ok {
- return ErrNotFound
+ return fmt.Errorf("%w: %d", ErrNotFound, transactionID)
}
if err := transaction.vote(ctx, node, hash); err != nil {
@@ -268,7 +268,7 @@ func (mgr *Manager) StopTransaction(ctx context.Context, transactionID uint64) e
mgr.lock.Unlock()
if !ok {
- return ErrNotFound
+ return fmt.Errorf("%w: %d", ErrNotFound, transactionID)
}
if err := transaction.stop(); err != nil {