1. 09 Sep, 2021 1 commit
  2. 01 Sep, 2021 1 commit
    • Shaya Potter's avatar
      include the prev_log_idx in the appendentry response (#45) · 64747dee
      Shaya Potter authored
      the problem we have is that 2 appendentries can be in process in parallel
      
      Howver, the response handler doesn't expect this, it will reset the next_idx in both, but currently resets next_idx based on next_idx's value, not the old value that was the basis of prev_log_idx.
      
      Solution: return prev_log_idx in the response
      
      Problem with solution: prev_log_idx is not always based on next_idx from node, but can be based on a snapshot idx if it no longer exists. I haven't coded this yet, but perhaps can determine if the prev_log_idx that is returned is the snapshot_idx and if so, then dont increment by 1. Its possible we could pass even another flag into the appendentries struct to say if its a snapshot, but that's ugly.
      
      In addition, we increment msg_id on each appendentries so that if a response comes back out of order and we have already accepted the later response, we just ignore this response.
      
      In addition, on appendentry response, even if the appendentry wasn't a success, as long as its the same term as us (i.e. we are still the leader) then for leader/quorum purposes, that is sufficient, so move up set_last_ack to right after term test.
      64747dee
  3. 31 Aug, 2021 1 commit
  4. 30 Aug, 2021 1 commit
  5. 24 Aug, 2021 1 commit
  6. 22 Aug, 2021 1 commit
    • Shaya Potter's avatar
      add duplex partition to virtraft (#42) · 95764a87
      Shaya Potter authored
      before, purposefully, virtraft had simplex partitions (i.e. traffic was only blocked from flowing one way).
      
      however, for read_queue tests and for correctness of them, we have to ensure that its duplex (i.e. neither side can talk to each other).
      
      otherwise, we can end up in a situation, where leader heartbeated every node, the majority of the nodes got the ping, but the majority couldn't reply back.  If there's a bug in libraft's calculation, by simply looking at the other nodes, we would think everything is fine, as they got the heartbeat
      95764a87
  7. 19 Aug, 2021 1 commit
  8. 18 Aug, 2021 2 commits
  9. 16 Aug, 2021 1 commit
  10. 11 Aug, 2021 2 commits
  11. 06 Aug, 2021 1 commit
  12. 04 Aug, 2021 1 commit
  13. 03 Aug, 2021 1 commit
    • Shaya Potter's avatar
      Improve entry "vote/append couting" in the case of a leader demotion (#13) · 99e3d4a6
      Shaya Potter authored
      Before, we only did "auto commit" of entries if the number of voters == 1.  As we can have a "non voting leader", this is wrong, as the voter can be another node, not the leader, therefore we add a condition to ensure that the leader is a voter too, so that we know that the leader is the single voter.
      
      99e3d4a6
  14. 02 Aug, 2021 1 commit
  15. 01 Aug, 2021 1 commit
  16. 30 Jul, 2021 1 commit
    • Shaya Potter's avatar
      remove REMOVE_NODE log type and include its semantics in DEMOTE (#25) · d4d15e04
      Shaya Potter authored
      this commit changes libraft's from using the DEMOTE_NODE log entry which would then initiate a REMOVE_NODE log entry on the DEMOTE's commit, to only using a REMOVE.  
      
      * add the removal of the active node flag on append of REMOVE and (add back if reverted)
      * modify is_voting to check for active state as well
      
      this enables simplifying appending and reverting nodes, as we shouldn't be touching voting state, (as a removing node might not be voting yet), only its active state.  and as the is_voting check also now checks for active state, simplifies a lot of code that manually tested both.
      
      * add a test for reversion of a non voting node removal
      
      previously, the code could not handle demoting/removing a non voting node, as demote would want to unset the voting flag (which a non voting node obviously doesn't have), and would therefore fail an assertion.
      
      with the new code, we no longer unset the voting flag in removal, and this test make sure both the is_voting and is_active return as expected through a process of add/removal/revert
      d4d15e04
  17. 28 Jul, 2021 1 commit
    • Shaya Potter's avatar
      Multiple Virtraft changes (#8) · 0d2189c8
      Shaya Potter authored
      
      
      * fix virtraft bug in _check_log_matching
      
      didn't validate against snapshoted node correctly.  the previous code just didn't do what it was expected to do
      
      * improve virtraft logging
      
      * fix entry_pop in virtraft
      
      previously, entry_pop never ran during our virtraft tests, probably because without removing leader, we never have a situation where this is neccessary
      
      i.e. the only case virtraft can pop entries, is when we have a leader lose leadership and we have an entry pending and not committed.  so when another node becomes leader, old leader's entries get popped.
      
      however, that has nothing to do with the "id" of the node that its effecting so trying to contorl it through that, makes no sense.
      
      * extra comment for fix reminder
      
      * ensure that we start with a term of 1 in virtraft, not 0.
      
      snapshot code fails if we have a snapshot term of 0 (explicitly returns an error if the term stored in snapshot is 0).
      Co-authored-by: default avatarYossi Gottlieb <yossigo@gmail.com>
      0d2189c8
  18. 27 Jul, 2021 1 commit
    • Shaya Potter's avatar
      match up raft_get_last_log_term() to should_grant_vote() (#14) · fab583d6
      Shaya Potter authored
      raft_get_last_log_term() is used for filling in vote requests, except it didn't match 100% with the logic in should_grant_vote
      
      * update test to prove that change works as needed
      
      previous test tested when we don't snapshot everything, but code was broken when we did.
      modified test tested only when we snapshot everything, now we do both in sequence.
      
      * use raft_get_last_log_term in __should_grant_vote()
      
      also modify __should_grant_vote to take a raft_server_t instead of raft_server_privat_t so its not constantly casting it to void.
      fab583d6
  19. 26 Jul, 2021 1 commit
    • Shaya Potter's avatar
      only promote node to voting when its nonvoting has been applied (#12) · 600cf4fe
      Shaya Potter authored
      before we were able to promote a "ready" but not applied nonvoting node to a voting state, which means it would change the calculation as could vote for itself to be added.
      
      * fix tests that check for has_sufficient_logs
      
      because of a fix put in to not allow a node to be added until its "addition" as a non voter was comitted, that broke existing tests where that flag wasn't being set and testing that the nodes could be promoted
      
      * add a test that has_sufficient_logs will fail if addition not committed yet
      
      code before would add a node as a voter (via has_sufficient_logs) even if the initial non voter addition wasn't committed
      
      the test for this in the code actually tested after setting addition_committed.  add a test that does the same without that flag being set and expects that has_sufficient_logs will not be set
      600cf4fe
  20. 19 Jul, 2021 2 commits
  21. 23 May, 2021 1 commit
  22. 11 May, 2021 1 commit
    • Shaya Potter's avatar
      Fix quorum_msg_id assert (#3) · 93186886
      Shaya Potter authored
      Before this commit, active and voting flags were ignored resulting with a result that does not agree with `raft_get_num_voting_nodes()` and an assertion.
      
      This could be seen when a leader node gets removed while a read operation is in progress.
      93186886
  23. 29 May, 2020 1 commit
  24. 27 May, 2020 1 commit
  25. 26 May, 2020 1 commit
  26. 24 May, 2020 1 commit
  27. 16 Apr, 2020 1 commit
  28. 23 Mar, 2020 2 commits
    • Yossi Gottlieb's avatar
      Fix issue with AE not delivered to removed nodes. · 02fda63f
      Yossi Gottlieb authored
      During joint consensus, we need to deliver entries to demoted and
      removed nodes so they can gracefully shut down.
      
      This also fixes an issue with raft_send_appendentries_all() which
      aborted on first delivery error, creating artificial cluster partitions.
      This problem is further aggravated when attempting to deliver to
      inactive nodes.
      02fda63f
    • Yossi Gottlieb's avatar
      Revert commits c3064082 and da936a95. · 2c105362
      Yossi Gottlieb authored
      Turns out documentation is not up to date regarding the process of node
      removal, and it the current implementation assumes a two-phase process
      is always required (i.e. DEMOTE followed by REMOVE).
      2c105362
  29. 12 Mar, 2020 2 commits
    • Yossi Gottlieb's avatar
      Add RAFT_LOGTYPE_NO_OP. · 5d7915f3
      Yossi Gottlieb authored
      The no-op entry gets committed as soon as a new leader is elected, in
      order to establish the commit index and prevent stale reads.
      5d7915f3
    • Yossi Gottlieb's avatar
      Fix virtraft membership tests. · c3064082
      Yossi Gottlieb authored
      This fixes an issue with virtraft2 which was not able to perform
      REMOVE_NODE when DEMOTE_NODE was applied. The previous fix of directly
      removing nodes was not aligned with how virtraft2 manages nodes.
      c3064082
  30. 10 Mar, 2020 4 commits
  31. 31 Dec, 2018 1 commit
  32. 19 Dec, 2018 1 commit