You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2022/10/14 14:45:08 UTC

[couchdb] branch raft_storemodule updated: eliminate spurious election

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch raft_storemodule
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/raft_storemodule by this push:
     new da84ec8d5 eliminate spurious election
da84ec8d5 is described below

commit da84ec8d5143789412f53a7b6a63975312a57c57
Author: Robert Newson <rn...@apache.org>
AuthorDate: Fri Oct 14 15:40:42 2022 +0100

    eliminate spurious election
    
    (We start an election when we get a new_election timeout)
---
 src/couch/src/couch_raft.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/couch/src/couch_raft.erl b/src/couch/src/couch_raft.erl
index b847a1b50..ae31ab89e 100644
--- a/src/couch/src/couch_raft.erl
+++ b/src/couch/src/couch_raft.erl
@@ -80,7 +80,7 @@ handle_event(enter, _OldState, follower, Data) ->
 handle_event(enter, _OldState, candidate, Data) ->
     #{term := Term} = Data,
     couch_log:notice("~p became candidate in term ~B", [id(Data), Term]),
-    persist({keep_state, start_election(Data), state_timeout(candidate)});
+    {keep_state_and_data, state_timeout(candidate)};
 
 handle_event(enter, _OldState, leader, Data) ->
     #{store_module := StoreModule, cohort := Cohort, term := Term} = Data,