diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2020-09-25 10:10:01 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2020-09-25 10:10:01 +0300 |
commit | c731780e774b78611a5cb229588c080619f6c4f5 (patch) | |
tree | 8010e3c528c2d7eca1bbcdd8878d2ef9f0927f64 | |
parent | a4ef89fca31c8e55b41ed1417387c78b1d03e6ee (diff) | |
parent | aa59dc2b5b730c9d68e5fc904d4289ae2b7bb55a (diff) |
Merge branch 'pks-tx-remove-service-feature-flags' into 'master'
transactions: Remove service-specific feature flags
See merge request gitlab-org/gitaly!2599
-rw-r--r-- | changelogs/unreleased/pks-tx-remove-service-feature-flags.yml | 5 | ||||
-rw-r--r-- | internal/metadata/featureflag/feature_flags.go | 9 | ||||
-rw-r--r-- | internal/praefect/coordinator.go | 29 |
3 files changed, 15 insertions, 28 deletions
diff --git a/changelogs/unreleased/pks-tx-remove-service-feature-flags.yml b/changelogs/unreleased/pks-tx-remove-service-feature-flags.yml new file mode 100644 index 000000000..d4a7304aa --- /dev/null +++ b/changelogs/unreleased/pks-tx-remove-service-feature-flags.yml @@ -0,0 +1,5 @@ +--- +title: 'transactions: Remove service-specific feature flags' +merge_request: 2599 +author: +type: changed diff --git a/internal/metadata/featureflag/feature_flags.go b/internal/metadata/featureflag/feature_flags.go index 19c32ca43..6f48f055d 100644 --- a/internal/metadata/featureflag/feature_flags.go +++ b/internal/metadata/featureflag/feature_flags.go @@ -17,12 +17,6 @@ var ( GoPostReceiveHook = FeatureFlag{Name: "go_postreceive_hook", OnByDefault: true} // ReferenceTransactions will handle Git reference updates via the transaction service for strong consistency ReferenceTransactions = FeatureFlag{Name: "reference_transactions", OnByDefault: true} - // ReferenceTransactionsOperationService will enable reference transactions for the OperationService - ReferenceTransactionsOperationService = FeatureFlag{Name: "reference_transactions_operation_service", OnByDefault: true} - // ReferenceTransactionsSmartHTTPService will enable reference transactions for the SmartHTTPService - ReferenceTransactionsSmartHTTPService = FeatureFlag{Name: "reference_transactions_smarthttp_service", OnByDefault: true} - // ReferenceTransactionsSSHService will enable reference transactions for the SSHService - ReferenceTransactionsSSHService = FeatureFlag{Name: "reference_transactions_ssh_service", OnByDefault: true} // ReferenceTranasctiionsPrimaryWins will change transaction registration such that // secondaries will take part in transactions, but not influence their outcome. ReferenceTransactionsPrimaryWins = FeatureFlag{Name: "reference_transactions_primary_wins", OnByDefault: false} @@ -48,9 +42,6 @@ var All = []FeatureFlag{ DistributedReads, GoPostReceiveHook, ReferenceTransactions, - ReferenceTransactionsOperationService, - ReferenceTransactionsSmartHTTPService, - ReferenceTransactionsSSHService, ReferenceTransactionsPrimaryWins, ReferenceTransactionHook, RubyReferenceTransactionHook, diff --git a/internal/praefect/coordinator.go b/internal/praefect/coordinator.go index 4d13dd54e..3d752512b 100644 --- a/internal/praefect/coordinator.go +++ b/internal/praefect/coordinator.go @@ -192,31 +192,22 @@ func (c *Coordinator) accessorStreamParameters(ctx context.Context, call grpcCal }, nil, nil, nil), nil } -var transactionRPCs = map[string]featureflag.FeatureFlag{ - "/gitaly.OperationService/UserCreateBranch": featureflag.ReferenceTransactionsOperationService, - "/gitaly.OperationService/UserCreateTag": featureflag.ReferenceTransactionsOperationService, - "/gitaly.OperationService/UserDeleteBranch": featureflag.ReferenceTransactionsOperationService, - "/gitaly.OperationService/UserDeleteTag": featureflag.ReferenceTransactionsOperationService, - "/gitaly.OperationService/UserUpdateBranch": featureflag.ReferenceTransactionsOperationService, - "/gitaly.SSHService/SSHReceivePack": featureflag.ReferenceTransactionsSSHService, - "/gitaly.SmartHTTPService/PostReceivePack": featureflag.ReferenceTransactionsSmartHTTPService, +var transactionRPCs = map[string]interface{}{ + "/gitaly.OperationService/UserCreateBranch": nil, + "/gitaly.OperationService/UserCreateTag": nil, + "/gitaly.OperationService/UserDeleteBranch": nil, + "/gitaly.OperationService/UserDeleteTag": nil, + "/gitaly.OperationService/UserUpdateBranch": nil, + "/gitaly.SSHService/SSHReceivePack": nil, + "/gitaly.SmartHTTPService/PostReceivePack": nil, } func shouldUseTransaction(ctx context.Context, method string) bool { if !featureflag.IsEnabled(ctx, featureflag.ReferenceTransactions) { return false } - - flag, ok := transactionRPCs[method] - if !ok { - return false - } - - if !featureflag.IsEnabled(ctx, flag) { - return false - } - - return true + _, ok := transactionRPCs[method] + return ok } func (c *Coordinator) registerTransaction(ctx context.Context, primary Node, secondaries []Node) (*transactions.Transaction, transactions.CancelFunc, error) { |