Skip to content

Commit

Permalink
kvserver: get replicaID from p in proposeBatch
Browse files Browse the repository at this point in the history
Epic: none
Release note: None
  • Loading branch information
tbg committed Jun 12, 2023
1 parent 8849ffd commit 5f00a81
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/kv/kvserver/replica_proposal_buf.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ type admitEntHandle struct {
}

type singleBatchProposer interface {
getReplicaID() roachpb.ReplicaID
flowControlHandle(ctx context.Context) kvflowcontrol.Handle
onErrProposalDropped([]raftpb.Entry)
}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit 5f00a81

Please sign in to comment.