Hello David Ribeiro Alves, Mike Percy,
I'd like you to do a code review. Please visit
to review the following change.
Change subject: WIP: consensus: refactor tracking of received OpIds out of
WIP: consensus: refactor tracking of received OpIds out of ReplicaState
The PeerMessageQueue class was already tracking the last appended OpId, so
tracking it in ReplicaState was redundant and confusing. This removes a
bunch of stuff from ReplicaState and adds just a little bit of new
functionality to PeerMessageQueue:
- TruncateOpsAfter() now takes an index instead of an OpId. The queue
can already map the index to an OpId by asking the log.
- Added a getter to expose the last OpId in the log back to RaftConsensus
- Changed OpId generation to happen in PeerMessageQueue. This was easy
because it already knows the previous OpId and the current term.
The 'last_received_cur_leader' tracking was moved into RaftConsensus
itself, since it's just transient state tracking the RPC back-and-forths
between a leader and the follower.
This patch also removes raft_consensus-test, the mock-based testing for
RaftConsensus. I found that maintaining this test was very difficult, in
particular because now we rely on the fact that AppendOperations() is
reflected in GetLastOpIdInLog(). With a mock PeerMessageQueue, this
state update wasn't happening properly, and trying to reproduce that
behavior in the mocks themselves seemed like I was basically
re-implementing the actual production code for the queue. I looked over
the tests in this suite and I believe all of the cases are covered by
various other tests (randomized and otherwise).
I looped raft_consensus-itest 100 times, the Churny test case 1000
times, and exactly_once_writes-itest 1000 times. Lastly, I was
able to re-enable TestChurnyElections_WithNotificationLatency and loop
it 500 times.
10 files changed, 52 insertions(+), 795 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/76/4476/1
To view, visit http://gerrit.cloudera.org:8080/4476
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Owner: Todd Lipcon <t...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <dral...@apache.org>
Gerrit-Reviewer: Mike Percy <mpe...@apache.org>