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-07-08 17:08:21 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-09-02 08:23:56 +0300
commit62cdae73245218c73033800222524f7642e9bcd2 (patch)
tree8faafc1259bbc67cdbd9367b7c7cd9521cff3dab
parenteb16bd967deda87f31f83150b7404aa2afa28a93 (diff)
transactions: Remove `DidCommitAnySubtransactions()`
The interface function `DidCommitAnySubtransactions()` isn't used by any callsite anymore. Drop it. (cherry picked from commit 528e8e926ef90d35ca85601f1eb28a947d63bea3)
-rw-r--r--internal/praefect/coordinator_test.go11
-rw-r--r--internal/praefect/transactions/transaction.go24
2 files changed, 3 insertions, 32 deletions
diff --git a/internal/praefect/coordinator_test.go b/internal/praefect/coordinator_test.go
index 6482d13e2..8c926d9db 100644
--- a/internal/praefect/coordinator_test.go
+++ b/internal/praefect/coordinator_test.go
@@ -1542,10 +1542,9 @@ func TestCoordinator_grpcErrorHandling(t *testing.T) {
}
type mockTransaction struct {
- nodeStates map[string]transactions.VoteResult
- subtransactions int
- didCommitAnySubtransaction bool
- didVote map[string]bool
+ nodeStates map[string]transactions.VoteResult
+ subtransactions int
+ didVote map[string]bool
}
func (t mockTransaction) ID() uint64 {
@@ -1556,10 +1555,6 @@ func (t mockTransaction) CountSubtransactions() int {
return t.subtransactions
}
-func (t mockTransaction) DidCommitAnySubtransaction() bool {
- return t.didCommitAnySubtransaction
-}
-
func (t mockTransaction) DidVote(node string) bool {
return t.didVote[node]
}
diff --git a/internal/praefect/transactions/transaction.go b/internal/praefect/transactions/transaction.go
index 3f4af4699..6baf696a5 100644
--- a/internal/praefect/transactions/transaction.go
+++ b/internal/praefect/transactions/transaction.go
@@ -57,8 +57,6 @@ type Transaction interface {
CountSubtransactions() int
// State returns the state of each voter part of the transaction.
State() (map[string]VoteResult, error)
- // DidCommitAnySubtransaction returns whether the transaction committed at least one subtransaction.
- DidCommitAnySubtransaction() bool
// DidVote returns whether the given node has cast a vote.
DidVote(string) bool
}
@@ -188,28 +186,6 @@ func (t *transaction) CountSubtransactions() int {
return len(t.subtransactions)
}
-// DidCommitSubtransaction returns whether the transaction committed at least one subtransaction.
-func (t *transaction) DidCommitAnySubtransaction() bool {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- if len(t.subtransactions) == 0 {
- return false
- }
-
- // We only need to check the first subtransaction. If it failed, there would
- // be no further subtransactions.
- for _, result := range t.subtransactions[0].state() {
- // It's sufficient to find a single commit in the subtransaction
- // to say it was committed.
- if result == VoteCommitted {
- return true
- }
- }
-
- return false
-}
-
// DidVote determines whether the given node did cast a vote. If it's not possible to retrieve the
// vote, then the node by definition didn't cast a vote.
func (t *transaction) DidVote(node string) bool {