diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-08 12:44:00 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-13 09:47:19 +0300 |
commit | 0c08541cf496d76c5611ee1e7bcfc49724dbcc21 (patch) | |
tree | 29b68a66844035f3aff356eee866657fdda04a87 /ruby | |
parent | dac1c323929b21e9ab0fc98af3e79dec3495b2a0 (diff) |
proto: Introduce transactional voting phases
Transactional votes currently only contain information about the vote
that we actually want to cast, but it doesn't contain any sort of
metadata which would allow us to more precisely track the nature of a
specific vote. Most importantly, while we already use "preparatory" and
"committing" votes in almost all places, they are only preparatory and
committing votes by convention: there is no metadata which would allow
us to discern these cases.
Amend the voting RPC call to use "phases", which currently knows three
different phases:
- "unknown": this is the current default which we'll need to support
until all voting callsites have been converted to use proper
phases.
- "prepared": the change has been prepared to be committed. Locks
have been taken already, but no change has yet been committed to
disk such that they would be visible to the user.
- "committed": changes have been committed to disk and are thus both
persistent and visible to the user.
With these phases, we can eventually build additional logic into
Praefect which makes use of them. This includes creating less
replication jobs if no change was committed, making two-phase voting a
necessity instead of a convention, and potentially others.
Changelog: added
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/proto/gitaly/transaction_pb.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ruby/proto/gitaly/transaction_pb.rb b/ruby/proto/gitaly/transaction_pb.rb index 59c7f5626..01a04bf3c 100644 --- a/ruby/proto/gitaly/transaction_pb.rb +++ b/ruby/proto/gitaly/transaction_pb.rb @@ -12,6 +12,12 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :transaction_id, :uint64, 2 optional :node, :string, 3 optional :reference_updates_hash, :bytes, 4 + optional :phase, :enum, 5, "gitaly.VoteTransactionRequest.Phase" + end + add_enum "gitaly.VoteTransactionRequest.Phase" do + value :UNKNOWN_PHASE, 0 + value :PREPARED_PHASE, 1 + value :COMMITTED_PHASE, 2 end add_message "gitaly.VoteTransactionResponse" do optional :state, :enum, 1, "gitaly.VoteTransactionResponse.TransactionState" @@ -32,6 +38,7 @@ end module Gitaly VoteTransactionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.VoteTransactionRequest").msgclass + VoteTransactionRequest::Phase = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.VoteTransactionRequest.Phase").enummodule VoteTransactionResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.VoteTransactionResponse").msgclass VoteTransactionResponse::TransactionState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.VoteTransactionResponse.TransactionState").enummodule StopTransactionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.StopTransactionRequest").msgclass |