Todd Lipcon has submitted this change and it was merged. Change subject: consensus_peers: schedule raft heartbeats through messenger ......................................................................
consensus_peers: schedule raft heartbeats through messenger This patch switches Peer to a Messenger-based approach (i.e. Messenger::ScheduleOnReactor) for scheduling heartbeats. The problem with ResettableHeartbeater was that it creates a dedicated thread per replica, and I couldn't see an easy way to share it across replicas. The scheduling is inspired by libev's "Let the timer time out, but then re-arm it as required" approach[1]. Callbacks are never canceled since the Messenger doesn't support that. Instead, the next heartbeat time is maintained as out-of-band state, and we ensure that the callback period is low enough that it can honor any heartbeat time. 1. http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#code_ev_timer_code_relative_and_opti Change-Id: Iac8e09fe02dd32885ef0cf644cb093b1c8e6afb8 Reviewed-on: http://gerrit.cloudera.org:8080/7331 Tested-by: Kudu Jenkins Reviewed-by: Todd Lipcon <[email protected]> --- M src/kudu/consensus/consensus-test-util.h M src/kudu/consensus/consensus_peers-test.cc M src/kudu/consensus/consensus_peers.cc M src/kudu/consensus/consensus_peers.h M src/kudu/consensus/leader_election-test.cc M src/kudu/consensus/peer_manager.cc M src/kudu/consensus/raft_consensus_quorum-test.cc M src/kudu/tserver/tablet_copy_source_session-test.cc 8 files changed, 199 insertions(+), 57 deletions(-) Approvals: Todd Lipcon: Looks good to me, approved Kudu Jenkins: Verified -- To view, visit http://gerrit.cloudera.org:8080/7331 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iac8e09fe02dd32885ef0cf644cb093b1c8e6afb8 Gerrit-PatchSet: 5 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Adar Dembo <[email protected]> Gerrit-Reviewer: Adar Dembo <[email protected]> Gerrit-Reviewer: David Ribeiro Alves <[email protected]> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Mike Percy <[email protected]> Gerrit-Reviewer: Tidy Bot Gerrit-Reviewer: Todd Lipcon <[email protected]>
