From 5f00a810f3f30d21309eeb2ee2ebdc592c82c3d7 Mon Sep 17 00:00:00 2001 From: Tobias Grieger Date: Mon, 12 Jun 2023 09:14:30 +0200 Subject: [PATCH] kvserver: get replicaID from p in proposeBatch Epic: none Release note: None --- pkg/kv/kvserver/replica_proposal_buf.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/kv/kvserver/replica_proposal_buf.go b/pkg/kv/kvserver/replica_proposal_buf.go index 835c1faea183..1e5b3e85d5e9 100644 --- a/pkg/kv/kvserver/replica_proposal_buf.go +++ b/pkg/kv/kvserver/replica_proposal_buf.go @@ -143,6 +143,7 @@ type admitEntHandle struct { } type singleBatchProposer interface { + getReplicaID() roachpb.ReplicaID flowControlHandle(ctx context.Context) kvflowcontrol.Handle onErrProposalDropped([]raftpb.Entry) } @@ -154,7 +155,6 @@ type proposer interface { // The following require the proposer to hold (at least) a shared lock. singleBatchProposer - getReplicaID() roachpb.ReplicaID destroyed() destroyStatus firstIndex() kvpb.RaftIndex leaseAppliedIndex() kvpb.LeaseAppliedIndex @@ -519,7 +519,7 @@ func (b *propBuf) FlushLockedWithRaftGroup( // Flush any previously batched (non-conf change) proposals to // preserve the correct ordering or proposals. Later proposals // will start a new batch. - propErr, _ := proposeBatch(ctx, b.p, raftGroup, b.p.getReplicaID(), ents, admitHandles, buf[firstProp:nextProp]) + propErr, _ := proposeBatch(ctx, b.p, raftGroup, ents, admitHandles, buf[firstProp:nextProp]) if propErr != nil { firstErr = propErr continue @@ -588,7 +588,7 @@ func (b *propBuf) FlushLockedWithRaftGroup( return 0, firstErr } - propErr, _ := proposeBatch(ctx, b.p, raftGroup, b.p.getReplicaID(), ents, admitHandles, buf[firstProp:nextProp]) + propErr, _ := proposeBatch(ctx, b.p, raftGroup, ents, admitHandles, buf[firstProp:nextProp]) return used, propErr } @@ -952,7 +952,6 @@ func proposeBatch( ctx context.Context, p singleBatchProposer, raftGroup proposerRaft, - replID roachpb.ReplicaID, // TODO(tbg): can get this from p ents []raftpb.Entry, handles []admitEntHandle, props []*ProposalData, // must match ents slice @@ -965,7 +964,7 @@ func proposeBatch( } err := raftGroup.Step(raftpb.Message{ Type: raftpb.MsgProp, - From: uint64(replID), + From: uint64(p.getReplicaID()), Entries: ents, }) if err != nil && errors.Is(err, raft.ErrProposalDropped) {