1. 20 Jun, 2018 2 commits
  2. 13 Jun, 2018 2 commits
  3. 11 Jun, 2018 3 commits
    • Yossi Gottlieb's avatar
      Ignore RequestVote when leader is established. (#58) · ab96a768
      Yossi Gottlieb authored
      This behavior is described in the original Raft paper and is required to
      prevent removed nodes from disrupting the cluster.
      
      This causes other problems though, as a split node may trigger election
      which is rejected but leaves it with a future term.  The generally
      accepted solution for this appears to be the use of PreVote RPC to avoid
      election that can never succeed.
      ab96a768
    • Willem Thiart's avatar
      Add virtraft2 · aa3586ff
      Willem Thiart authored
      aa3586ff
    • Willem Thiart's avatar
      Add notify_membership_event callback · 3ff2682d
      Willem Thiart authored
      This is an optional callback.
      
      This is useful for the user to know when a node has been added/removed,
      so that something like raft_node_set_udata can be set properly.
      3ff2682d
  4. 08 Jun, 2018 1 commit
  5. 07 Jun, 2018 2 commits
    • Willem Thiart's avatar
      Remove RAFT_LOGTYPE_SNAPSHOT · 700eebe6
      Willem Thiart authored
      The RAFT_LOGTYPE_SNAPSHOT was a bad design choice. It's better to not
      have this marker entry so that users don't have to check for the log
      entry type in the callbacks. Also, loading a snapshot correctly created
      this marker entry, but the compaction side did not. It's better to
      remove this log type than to fix this asymmetry.
      
      Fixes the following edge cases:
      - Server crashes if the last snapshot index is N and a appendentries
      message pops entries all the way back to index N.
      - Server sends an appendentries message with an invalid prev_log_idx and
      prev_log_term, causing the peer to crash.
      700eebe6
    • Yossi Gottlieb's avatar
      Off by one fixes (#65) · 9de8af47
      Yossi Gottlieb authored
      * Fix off-by-one in apply_log idx.
      
      * Fix log_get_from_idx() off by one error.
      9de8af47
  6. 17 May, 2018 3 commits
  7. 16 May, 2018 3 commits
  8. 08 Jan, 2018 2 commits
  9. 21 Nov, 2017 9 commits
    • Li Wei's avatar
      DAOS-333 server: Handle storage access errors · 76d56d0c
      Li Wei authored
      
      
      User storage callbacks may return negative errors smaller than
      RAFT_ERR_LAST. These will be returned all the way to the API methods,
      which report the errors back to users, so that appropriate handlings may
      be performed.
      Signed-off-by: default avatarLi Wei <wei.g.li@intel.com>
      76d56d0c
    • Li Wei's avatar
      DAOS-333 server: Don't remove later entries for matching AEs · 77fb6117
      Li Wei authored
      
      
      If an AE request's previous entry matches the follower's, then the
      follower doesn't need to truncate its log at prev_log_idx. When the
      follower checks if the other entries in the AE request are consistent
      with its local ones, it already takes care of truncating at any
      inconsistency. If any later entries not covered by this AE request are
      inconsistent, future AE requests shall truncate them.
      Signed-off-by: default avatarLi Wei <wei.g.li@intel.com>
      77fb6117
    • Li Wei's avatar
      Revert "Change: code now assumes callbacks are provided" · e33da84a
      Li Wei authored
      This reverts commit c3443aac. Test
      changes are left intact.
      e33da84a
    • Li Wei's avatar
      DAOS-279 server: Zero timeout_elapsed for leaders · 51e049fd
      Li Wei authored
      
      
      If raft_become_candidate() assigns a negative value e (i.e.,
      -election_timeout < e < 0) to timeout_elapsed, and if this replica
      successfully becomes the leader, then this leader won't send heartbeats
      for request_timeout - e milliseconds. This may be longer than
      election_timeout and cause an unnecessary leadership change.
      
      This patch zeroes timeout_elapsed in raft_become_leader(), randomizes
      election timeouts in [election_timeout, 2 * election_timeout), and fixes
      raft_recv_appendentries() to avoid zeroing timeout_elapsed if the AE
      request has an older term.
      Signed-off-by: default avatarLi Wei <wei.g.li@intel.com>
      51e049fd
    • Li Wei's avatar
      DAOS-279 server: Discard current_leader when term changes · 14a4e6a2
      Li Wei authored
      
      
      When a leader learns of a newer term and steps down, it should discard
      current_leader. Otherwise, a client request may be rejected with
      RAFT_ERR_NOT_LEADER and a hint pointing to this replica itself!
      
      For simplicity, this patche follows the Raft paper to discard
      current_leader whenever current_term changes. And, when receiving an AE
      with an up-to-date term, a server always updates current_leader, as this
      information is absolute, even if the previous entry doesn't match.
      
      This patch also fixes a test that has previously been failing due to
      incorrect node IDs.
      Signed-off-by: default avatarLi Wei <wei.g.li@intel.com>
      14a4e6a2
    • Li Wei's avatar
      DAOS-333 server: Remove unnecessary index check for AE requests · 5bad59c1
      Li Wei authored
      
      
      raft_recv_appendentries() doesn't need to check prev_log_idx against
      currentIndex, as this is already done implicitly by getting the entry at
      prev_log_idx.
      Signed-off-by: default avatarLi Wei <wei.g.li@intel.com>
      5bad59c1
    • Li Wei's avatar
      DAOS-333 server: Check AE reply term first · 8b444aa1
      Li Wei authored
      
      
      raft_recv_appendentries_response() should check r->term before checking
      r->current_idx.
      Signed-off-by: default avatarLi Wei <wei.g.li@intel.com>
      8b444aa1
    • Li Wei's avatar
      DAOS-333 server: Handle memory allocation errors · 6bf3f5f1
      Li Wei authored
      
      
      Check and handle memory allocation errors by reporting them back to
      users via NULL or RAFT_ERR_NOMEM return values.
      Signed-off-by: default avatarLi Wei <wei.g.li@intel.com>
      6bf3f5f1
    • Li Wei's avatar
      DAOS-279 log: Avoid changing caller input entry · 920d574a
      Li Wei authored
      
      
      log_append_entry() passes caller's raft_entry_t to log_offer. If the
      log_offer implementation sets the data buffer to different value,
      caller's raft_entry_t gets modified as a side effect. This is
      error-prone as callers are usually responsible for freeing the data
      buffer with such a log_offer implementation. This patch passes the
      raft_entry_t in the log to log_offer instead. Also, ety in
      raft_recv_entry() is no longer required.
      Signed-off-by: default avatarLi Wei <wei.g.li@intel.com>
      920d574a
  10. 20 Nov, 2017 2 commits
  11. 22 Jun, 2017 1 commit
  12. 21 Jun, 2017 2 commits
    • Willem Thiart's avatar
      Fixes #41 · 9651a97f
      Willem Thiart authored
      Second if statement was redundant.
      9651a97f
    • Willem Thiart's avatar
      Fixes #40 · 883d0d24
      Willem Thiart authored
      raft_send_requestvote and raft_send_appendentries now return proper
      error codes.
      883d0d24
  13. 20 Jun, 2017 1 commit
    • Willem Thiart's avatar
      Fixes #37 · 3e011ae2
      Willem Thiart authored
      Avoid deleting logs because of out-of-order/quick heartbeats.
      3e011ae2
  14. 24 May, 2017 1 commit
    • Willem Thiart's avatar
      Fixes #35 · 9bdf41b5
      Willem Thiart authored
      Avoid for loop to increase performance when tallying votes for
      committing.
      9bdf41b5
  15. 09 May, 2017 1 commit
    • Willem Thiart's avatar
      Change: code now assumes callbacks are provided · c3443aac
      Willem Thiart authored
      Beforehand there were if statements to check if callbacks were provided
      by the user. This was only useful for making the test suites shorter.
      These if statements have been removed so that the core code is more
      concise.
      c3443aac
  16. 20 Oct, 2016 1 commit
  17. 31 Aug, 2016 1 commit
  18. 11 Jun, 2016 3 commits