These are chat archives for atomix/atomix

13th
Sep 2016
terrytan
@txm119161336_twitter
Sep 13 2016 02:26
Hi, jordan , for the case like leader sends the append request ,failed , according to raft paper ,there will be retrying ,but i found your code ,

*/
private void updateHeartbeatTime(MemberState member, Throwable error) {
if (heartbeatFuture == null) {
return;
}

if (error != null && member.getHeartbeatStartTime() == heartbeatTime) {
  int votingMemberSize = context.getClusterState().getActiveMemberStates().size() + (context.getCluster().member().type() == Member.Type.ACTIVE ? 1 : 0);
  int quorumSize = (int) Math.floor(votingMemberSize / 2) + 1;
  // If a quorum of successful responses cannot be achieved, fail this heartbeat. Ensure that only
  // ACTIVE members are considered. A member could have been transitioned to another state while the
  // heartbeat was being sent.
  if (member.getMember().type() == Member.Type.ACTIVE && ++heartbeatFailures > votingMemberSize - quorumSize) {
    heartbeatFuture.completeExceptionally(new InternalException("Failed to reach consensus"));
    completeHeartbeat();
  }
} else {
  member.setHeartbeatTime(System.currentTimeMillis());

  // Sort the list of commit times. Use the quorum index to get the last time the majority of the cluster
  // was contacted. If the current heartbeatFuture's time is less than the commit time then trigger the
  // commit future and reset it to the next commit future.
  if (heartbeatTime <= heartbeatTime()) {
    heartbeatFuture.complete(null);
    completeHeartbeat();
  }
}

}

if it is failed ,and the heartbeatfailures is less than 3, it will stop heartbeat .
terrytan
@txm119161336_twitter
Sep 13 2016 02:57
Jordan ,i have figured it out myself ,just ignore it
Jordan Halterman
@kuujo
Sep 13 2016 20:36
Hey everyone, apologies. I have been gone on a last minute trip to St. Louis for a funeral... One of the few times I don't touch a computer for a few days. But I'm back and available again.