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>2022-03-02 13:40:30 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2022-03-02 16:02:34 +0300
commit54548d127e4b56971462e8d9159abdb28bbe4e0e (patch)
tree08a31058a7352ec6079f18aadbabdcf1e760fd18
parent4e5774f37ab8581cf0a988ffca97a6252078ddc8 (diff)
Mark RefTransactionService as handled by Praefect
This commit marks the RefTransactionService with the intercepted option to denote it is handled by Praefect. Such services do not need operation type annotations on the RPCs as they do not go through the proxy. This should have no behavioral changes and mostly just cleans up the code a bit.
-rw-r--r--internal/praefect/coordinator.go4
-rw-r--r--internal/praefect/protoregistry/protoregistry_test.go4
-rw-r--r--proto/go/gitalypb/transaction.pb.go25
-rw-r--r--proto/transaction.proto16
4 files changed, 19 insertions, 30 deletions
diff --git a/internal/praefect/coordinator.go b/internal/praefect/coordinator.go
index 302ae5665..41621914d 100644
--- a/internal/praefect/coordinator.go
+++ b/internal/praefect/coordinator.go
@@ -106,10 +106,6 @@ var transactionRPCs = map[string]transactionsCondition{
"/gitaly.RepositoryService/RepackIncremental": transactionsDisabled,
"/gitaly.RepositoryService/RestoreCustomHooks": transactionsDisabled,
"/gitaly.RepositoryService/WriteCommitGraph": transactionsDisabled,
-
- // These shouldn't ever use transactions for the sake of not creating cyclic dependencies.
- "/gitaly.RefTransaction/StopTransaction": transactionsDisabled,
- "/gitaly.RefTransaction/VoteTransaction": transactionsDisabled,
}
// forcePrimaryRoutingRPCs tracks RPCs which need to always get routed to the primary. This should
diff --git a/internal/praefect/protoregistry/protoregistry_test.go b/internal/praefect/protoregistry/protoregistry_test.go
index 28818ba74..4ce683c07 100644
--- a/internal/praefect/protoregistry/protoregistry_test.go
+++ b/internal/praefect/protoregistry/protoregistry_test.go
@@ -179,6 +179,10 @@ func TestNewProtoRegistry_IsInterceptedMethod(t *testing.T) {
"DatalossCheck",
"SetAuthoritativeStorage",
},
+ "RefTransaction": {
+ "VoteTransaction",
+ "StopTransaction",
+ },
} {
t.Run(service, func(t *testing.T) {
for _, method := range methods {
diff --git a/proto/go/gitalypb/transaction.pb.go b/proto/go/gitalypb/transaction.pb.go
index 7910a01d1..66956d527 100644
--- a/proto/go/gitalypb/transaction.pb.go
+++ b/proto/go/gitalypb/transaction.pb.go
@@ -397,24 +397,23 @@ var file_transaction_proto_rawDesc = []byte{
0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x04, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64,
0x22, 0x19, 0x0a, 0x17, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74,
- 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc8, 0x01, 0x0a, 0x0e,
- 0x52, 0x65, 0x66, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5a,
+ 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xbe, 0x01, 0x0a, 0x0e,
+ 0x52, 0x65, 0x66, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x52,
0x0a, 0x0f, 0x56, 0x6f, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x12, 0x1e, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x54,
0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x54,
0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
- 0x73, 0x65, 0x22, 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01, 0x12, 0x5a, 0x0a, 0x0f, 0x53, 0x74,
- 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e,
- 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73,
- 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e,
- 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73,
- 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06,
- 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62,
- 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2d, 0x6f, 0x72, 0x67, 0x2f,
- 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2f, 0x76, 0x31, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
- 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0x33,
+ 0x73, 0x65, 0x12, 0x52, 0x0a, 0x0f, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61,
+ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53,
+ 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53,
+ 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x04, 0xf0, 0x97, 0x28, 0x01, 0x42, 0x34, 0x5a, 0x32,
+ 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x6c, 0x61,
+ 0x62, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2f, 0x76, 0x31, 0x34,
+ 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79,
+ 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/proto/transaction.proto b/proto/transaction.proto
index 3d3e48de5..bccd2ab6b 100644
--- a/proto/transaction.proto
+++ b/proto/transaction.proto
@@ -8,21 +8,11 @@ import "lint.proto";
import "shared.proto";
service RefTransaction {
+ option (intercepted) = true;
- rpc VoteTransaction (VoteTransactionRequest) returns (VoteTransactionResponse) {
- option (op_type) = {
- op: MUTATOR
- scope_level: REPOSITORY
- };
- }
-
- rpc StopTransaction (StopTransactionRequest) returns (StopTransactionResponse) {
- option (op_type) = {
- op: MUTATOR
- scope_level: REPOSITORY
- };
- }
+ rpc VoteTransaction (VoteTransactionRequest) returns (VoteTransactionResponse);
+ rpc StopTransaction (StopTransactionRequest) returns (StopTransactionResponse);
}
message VoteTransactionRequest {