• 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
test_snapshotting.c 24.1 KB