1. 28 Aug, 2022 1 commit
  2. 25 Aug, 2022 2 commits
    • Ozan Tezcan's avatar
      Fix memory leak in raft_restore_log() (#126) · f1ab5203
      Ozan Tezcan authored
      f1ab5203
    • Ozan Tezcan's avatar
      Add support to rebuild configuration after a restart (#125) · 9c09a6cc
      Ozan Tezcan authored
      Configuration changes are special in Raft. They take effect 
      whenever the related log entries are appended. On a restart, 
      we should go over the log entries and rebuild the configuration.
      
      Adding raft_restore_log() function for this purpose.
      
      Overall, on a restart, application should do:
      
      Load the snapshot and call raft_restore_snapshot()
      Load the log entries and call raft_restore_log()
      Read the metadata file and call raft_restore_metadata().
      9c09a6cc
  3. 23 Aug, 2022 2 commits
  4. 22 Aug, 2022 2 commits
    • Ozan Tezcan's avatar
      Fix return types (#122) · e8791a27
      Ozan Tezcan authored
      Use typedef instead of the actual type
      e8791a27
    • Ozan Tezcan's avatar
      Improve snapshot support (#121) · 7d66a156
      Ozan Tezcan authored
      - raft_load_snapshot_f(): Changed order of arguments term and index
      to be inline with raft_begin_load_snapshot().
      
      - Refactored raft_begin_load_snapshot(). Now, inside this function, 
      current server's node flags are cleared. Previously, application had to
      take care of it. e.g Application had to clear inactive flag on a snapshot.
      
      - Added raft_restore_snapshot() to let libraft know that application has
      loaded a snapshot.
      7d66a156
  5. 16 Aug, 2022 2 commits
  6. 08 Aug, 2022 1 commit
  7. 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
  8. 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
  9. 30 Jun, 2022 1 commit
  10. 19 Jun, 2022 1 commit
  11. 19 May, 2022 1 commit
  12. 15 May, 2022 1 commit
  13. 02 May, 2022 1 commit
  14. 26 Apr, 2022 1 commit
  15. 25 Apr, 2022 1 commit
  16. 18 Apr, 2022 1 commit
  17. 06 Apr, 2022 1 commit
  18. 04 Apr, 2022 1 commit
  19. 03 Apr, 2022 1 commit
  20. 30 Mar, 2022 2 commits
  21. 24 Mar, 2022 1 commit
  22. 21 Mar, 2022 1 commit
  23. 13 Mar, 2022 5 commits
  24. 08 Mar, 2022 1 commit
  25. 06 Mar, 2022 1 commit
  26. 07 Feb, 2022 1 commit
  27. 07 Dec, 2021 1 commit
  28. 15 Nov, 2021 1 commit
  29. 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
  30. 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
  31. 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