• 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
raft_server.c 28.9 KB