Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kvserver: enable admitted vector protocol #130619

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 6 additions & 4 deletions pkg/kv/kvserver/replica_raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -1944,10 +1944,12 @@ func (r *Replica) sendRaftMessage(ctx context.Context, msg raftpb.Message) {
// admitted log indices, by priority.
if msg.Type == raftpb.MsgAppResp && !msg.Reject {
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 is lagging msg.Term, sending the admitted vector has no
// effect on the leader, so skip it.
// If msg.Term is lagging the admitted.Term, this is a message to a stale
// leader. Sending it allows that leader to release all tokens. It would
// otherwise do so soon anyway, upon learning about the new leader.
if admitted.Term >= msg.Term {
req.AdmittedState = kvflowcontrolpb.AdmittedState{
Term: admitted.Term,
Admitted: admitted.Admitted[:],
Expand Down
Loading