Skip to content

Commit

Permalink
kvserver: enable admitted vector protocol
Browse files Browse the repository at this point in the history
This commit enables AdmittedState annotations in RaftMessageRequest and
RaftMessageRequestBatch protocol. The leader starts receiving admitted
vector updates from all replicas.

Epic: none
Release note: none
  • Loading branch information
pav-kv authored and kvoli committed Sep 17, 2024
1 parent caa0ada commit bf8dc2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 0 additions & 4 deletions pkg/kv/kvserver/raft_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,10 +749,6 @@ func (t *RaftTransport) processQueue(
maybeAnnotateWithAdmittedStates := func(
batch *kvserverpb.RaftMessageRequestBatch, admitted []kvflowcontrolpb.PiggybackedAdmittedState,
) {
// TODO(pav-kv): send these protos once they are populated correctly.
if true {
return
}
batch.AdmittedStates = append(batch.AdmittedStates, admitted...)
}

Expand Down
8 changes: 5 additions & 3 deletions pkg/kv/kvserver/replica_raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -1932,11 +1932,13 @@ func (r *Replica) sendRaftMessage(ctx context.Context, msg raftpb.Message) {
// For RACv2, annotate successful MsgAppResp messages with the vector of
// admitted log indices, by priority.
if msg.Type == raftpb.MsgAppResp && !msg.Reject {
// TODO(pav-kv): Should we make it conditional to leader using RACv2? There
// is no harm in attaching these annotations, but the can end up being a
// no-op. OTOH, transition to V2 should be quick, so maybe it's fine not to
// bother.
admitted := r.flowControlV2.AdmittedState()
// The admitted state must be in the coordinate system of the leader's log.
if admitted.Term == msg.Term && false {
// TODO(pav-kv): enable this annotation when it is covered with tests, and
// the leader knows how to handle it.
if admitted.Term == msg.Term {
req.AdmittedState = kvflowcontrolpb.AdmittedState{
Term: admitted.Term,
Admitted: admitted.Admitted[:],
Expand Down

0 comments on commit bf8dc2f

Please sign in to comment.