rac2: [dnm] implement handle raft event
This commit implements HandleRaftEvent on the RangeController. When HandleRaftEvent is called by the Processor on the leader, the RangeController will perform local replica state management for the range and potentially return tokens if admitted has advanced. Additionally, any entries will subject to admission control will have corresponding tokens deducted and tracked.
Resolves: #129668 Release note: None
Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks.
:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.
TYFTR!
bors r=sumeerbhola
Build succeeded:
I'm confused. rangeController is relying on external synchronization (raftMu) for calls to itself (other than the WaitForEval path), which is why it doesn't have a mutex for its replicaMap. Any change to connectedState for a replicaSendStream happens in the context of this external synchronization, and AFAIK, all reads of connectedState too. That is, we call updateVoterSets while holding raftMu. Did I miss something? In the prototype there was at least one path that did not hold raftMu, specifically TokenAvailableNotification.Notify, so replicaSendStream did need its own mutex.
I'm confused. rangeController is relying on external synchronization (raftMu) for calls to itself (other than the WaitForEval path), which is why it doesn't have a mutex for its replicaMap.
My mistake, this was incorrect:
[...] but
updateVoterSetsreads theconnectedStatewhich can be written without holding theRangeController.muThismusynchronizes this access. It could also be an atomic for now but we will need themulater.
You're right, updateVoterSets is only called while holding raftMu, the synchronization on the replica send stream here is premature. I was confusing something.