1. 16 Aug, 2022 1 commit
  2. 08 Aug, 2022 1 commit
  3. 07 Jul, 2022 1 commit
    • Ozan Tezcan's avatar
      Throttle operations early not to block server (#108) · 40100cfa
      Ozan Tezcan authored
      Throttle operations early not to block server
      
      Introduced throttling in #106. If execution of operations take as much as request-timeout, it means this server will not generate responses on time for the existing requests. This is causing extra elections. I've changed deadline as 'now + request_timeout / 2', giving server some room for other operations and enough time to send responses.
      40100cfa
  4. 05 Jul, 2022 1 commit
    • Ozan Tezcan's avatar
      Do not execute operations in periodic when auto_flush is off (#109) · 03e2f294
      Ozan Tezcan authored
      Do not execute operations in periodic when auto_flush is off 
      
      Introduced auto_flush config in #81. If auto_flush is off, application is supposed to call raft_flush() manually. This function increments commit index, applies entries and sends appendentries requests.
      
      Currently, we execute operations in raft_periodic() and raft_flush() both. When auto_flush is off, it makes sense to leave execution to raft_flush() to do it in a single place.
      03e2f294
  5. 30 Jun, 2022 1 commit
  6. 19 Jun, 2022 1 commit
  7. 19 May, 2022 1 commit
  8. 15 May, 2022 1 commit
  9. 02 May, 2022 1 commit
  10. 26 Apr, 2022 1 commit
  11. 25 Apr, 2022 1 commit
  12. 18 Apr, 2022 1 commit
  13. 04 Apr, 2022 1 commit
  14. 03 Apr, 2022 1 commit
  15. 30 Mar, 2022 2 commits
  16. 24 Mar, 2022 1 commit
  17. 21 Mar, 2022 1 commit
  18. 13 Mar, 2022 4 commits
  19. 08 Mar, 2022 1 commit
  20. 06 Mar, 2022 1 commit
  21. 07 Feb, 2022 1 commit
  22. 07 Dec, 2021 1 commit
  23. 15 Nov, 2021 1 commit
  24. 03 Nov, 2021 1 commit
    • Shaya Potter's avatar
      set next_idx on each succesful raft_send_appendentries call (#65) · 02bdf818
      Shaya Potter authored
      this is to avoid sending duplicate entries each time raft_send_appendentries is called, just because they haven't been acked yet.
      
      it will still be reset backwards upon the leader receiving a raft_recv_appendentries_response() with a failure mode
      
      + a test for next_idx on append entry, which changes a number of tests which checked for this
      
      in order to do this, I had to modify the existing mock callback to return 0 instead of 1.  this needs to be verified
      
      + fixes for raft tests that this change exposed
      
      1) when we issues a sequence of entries, each was given an increasing term, so had entries whose term was higher than leaders term
      
      so had to fix that
      
      2) by setting the term of appendentries_repsonse to not be equal to leaders term (because of fix above), we now fail on receiving them
      
      do all that by not allowing raft_append_entry to append an entry that break raft semantics (i.e. term of entry > log term), but this breaks many tests that don't set term, so set them
      02bdf818
  25. 12 Oct, 2021 1 commit
    • Shaya Potter's avatar
      fix recording of voter change idx entry (#62) · a02be774
      Shaya Potter authored
      this was recorded in 2 places, inconsistently, when it only neededed to be recorded once.
      
      it was in raft_recv_entry() as
      
          if (raft_entry_is_voting_cfg_change(ety))
              me->voting_cfg_change_log_idx = raft_get_current_idx(me_);
      
      and in
      
      raft_append_entry() as
      
      me->voting_cfg_change_log_idx = raft_get_current_idx(me_) - 1;
      
      it only should be in raft_append_entry() becaues raft_recv_entry() is only from the leader, but its value was wrong, while raft_recv_entry() was correct.  This is also why it generally worked, if no leader election happened, it always had correct value, but if a new leader was elected that would have to commit this entry, it be wrong.
      a02be774
  26. 07 Oct, 2021 1 commit
    • Shaya Potter's avatar
      redo/tweak transfer leader in libraft (#61) · 63b0b1c1
      Shaya Potter authored
      this started off as a small tweak and grew a bit
      
      1) new callback for transfer leader result, along with its own enum of states
      
      2) change/remove raft_reset_transfer_leader() calls
      
      only call in places where there's a new leader or timeout (i.e. failed to transfer within period).
      
      so, we only reset in 3 places 1) recv_appendentries 2) raft_periodic (timeout) 3) raft_become_leader
      
      2a) raft_become_leader also got refactored a little to only issue the normal cb.notify_state_event() callback after it has set its state to be leader (as before, it could fail after the callback was issued)
      
      2b) in raft_periodic the raft_reset_transfer_leader() is pulled out the "if LEADER" block, as will lose leader when a vote is issued to it, we still want it to timeout if leadership isn't gained
      
      3) raft_reset_transfer_leader() does the logic for determining success/failure now, but becaue timeout is its own result which can't be determined by just looking at leader/desired, add a new flag to it to note timeout state
      
      4) leader stickiness in requestvote is only tested for prevote (as in a timeout now case, we want to drop the timeout now flag after prevotes are sent).  The idea is that we will only get to actual election if prevote passes.
      
      4) a bunch of new tests
      
      * fix issue with timeout flag to reset_transfer_leader
      
      also fix test to catch the original error
      
      * libraft/redisraft changes needed for e2e leader transfer
      
      * make leader stickiness only for prevote
      63b0b1c1
  27. 26 Sep, 2021 1 commit
    • Shaya Potter's avatar
      during previous rebases, raft_reset_transfer_leader() got moved (#60) · 4f94a895
      Shaya Potter authored
      it has to be after we notify the caller, not before, as caller needs the state to know what happened
      
      I had it before, realized it had to be after, but in efforts of rebasing previous PR, it got moved back to before, without me realizing.  Now that integrating it into redisraft, realized the problem
      4f94a895
  28. 23 Sep, 2021 2 commits
    • Shaya Potter's avatar
      Adding support for TimeoutNow RPC (#7) · 575335c3
      Shaya Potter authored
      this is the small modifications needed for raftlib to support timeout now rpc
      
      1) add a flag to requestvote type to tell other nodes its overriding normal chec
      2) new send_timeoutnow callback to send a timeout now rpc at right time
      3) call said callback is we've marked the node as timeout now and in raft_appendentries_response raft_get_current_idx(me_) == r->current_idx (i.e. response says the node's idx is up to date with leader)
      4) add helper functions to set/get/reset timeout flag on node structs for targeted node.
      
      how it would be used by client
      
      1) client of libraft will call raft_transfer_leader(raft_server_t* me_, raft_node_id_t node_id) to target the node they want to transfer to.
      
      2) client of libraft will provide the send_timeoutnow() callback for the actual sending of the rpc
      
      3) client of libraft will modify their existing notify_state_event() callback to observe the result of the timeout now operation.
      
      if it receives a RAFT_STATE_LEADERSHIP_TRANSFER_FAILED, then the transfer failed
      
      if it received a RAFT_STATE_FOLLOWER, then it inspects for the actual leader to see if its the expected one and can return that it was transferred to expected node or not
      
      if it received a RAFT_STATE_CANDIDATE, then the transfer also failed, as the targeted node sent a request vote which removed leadership, but wasn't able to win the election.
      
      With PreVote, this latter case should be very rare.
      575335c3
    • Ozan Tezcan's avatar
      Define separate callback function for node id retrieval (#55) · ce8b0f02
      Ozan Tezcan authored
      Define separate callback function for node id retrieval
      ce8b0f02
  29. 22 Sep, 2021 1 commit
    • Shaya Potter's avatar
      fix read queue test to be more accurate (#59) · 36efee07
      Shaya Potter authored
      * fix read queue test to be more accurate
      
      1) each server's set of nodes, keeps the max msg_id its seen from that node when that node has been later
      1a) because of this get_max_seen now operates on a server's nodes, not on the server itself b
      
      2) virtraft encodes the leader id into the "arg" (with a user redefinable multiplier) it sends as part of the callback, so when we get the callback, we can know what leader its for and check its voters for correctness.
      36efee07
  30. 15 Sep, 2021 2 commits
  31. 14 Sep, 2021 2 commits
  32. 12 Sep, 2021 1 commit
    • Shaya Potter's avatar
      add a read_queue test to virtraft (#41) · bdd0797f
      Shaya Potter authored
      * add a read_queue test to virtraft
      
      every iteration we push a read_queue request and the handler and an we pass to it set a variable on calling.  we can use this to make sure that the read_queue doesn't get too far from the iteration.  i.e. we pass the leader's msg_id and can check to ensure that leader's msg_id doesn't get too far from the msg_id (variable) we see in read_queue test
      
      this is analog to the current log applying deadlock test.
      
      * implements msg_id checking in virtraft for verification of read_queue requests
      
      When we pop an entry off the read_queue with the can_read flag, we verify across all nodes that the majority of nodes have accepted from the leader a msg_id past what this read_queue entry needs.
      
      the problem with this is, that until now, msg_id was private to each server instance and has no relevance to the followre nodes except to include it back in response. 
      
      we change that to have the followers store the max msg_id they've seen from their current leader
      
      using that, in the read_queue_handler we can verify that the leader's voting nodes have a quorum past the msg_id variable that the handler will return to ensure that this read_queue handler call is correct.
      bdd0797f
  33. 09 Sep, 2021 1 commit