@@ -961,7 +961,7 @@ leader(cast, ?REMOTE(?IDENTITY_REQUIRES_MIGRATION(_, FollowerId) = Sender, ?APPE
961961
962962 MatchIndex1 = MatchIndex0 #{FollowerId => FollowerEndIndex },
963963 OldNextIndex = maps :get (FollowerId , NextIndex0 , TermStartIndex ),
964- NextIndex1 = maps : put ( FollowerId , erlang :max (OldNextIndex , FollowerEndIndex + 1 ), NextIndex0 ) ,
964+ NextIndex1 = NextIndex0 #{ FollowerId => erlang :max (OldNextIndex , FollowerEndIndex + 1 )} ,
965965
966966 State2 = State1 # raft_state {match_index = MatchIndex1 , next_index = NextIndex1 },
967967 State3 = maybe_apply (State2 ),
@@ -983,7 +983,7 @@ leader(cast, ?REMOTE(?IDENTITY_REQUIRES_MIGRATION(_, FollowerId) = Sender, ?APPE
983983 % applied a snapshot since the last successful heartbeat. In such case, we need
984984 % to fast-forward the follower's next index so that we resume replication at the
985985 % point after the snapshot.
986- NextIndex1 = maps : put ( FollowerId , FollowerEndIndex + 1 , NextIndex0 ) ,
986+ NextIndex1 = NextIndex0 #{ FollowerId => FollowerEndIndex + 1 } ,
987987 State1 = State0 # raft_state {next_index = NextIndex1 },
988988 State2 = maybe_apply (State1 ),
989989 {keep_state , maybe_heartbeat (State2 ), ? HEARTBEAT_TIMEOUT (State2 )};
@@ -1537,7 +1537,7 @@ candidate(cast, ?REMOTE(?IDENTITY_REQUIRES_MIGRATION(_, NodeId), ?VOTE(true)),
15371537% % [Vote RPC] Candidate receives a negative vote (Candidate cannot become leader here. Losing
15381538% % an election does not need to convert candidate to follower.) (5.2)
15391539candidate (cast , ? REMOTE (? IDENTITY_REQUIRES_MIGRATION (_ , NodeId ), ? VOTE (false )), # raft_state {votes = Votes } = State ) ->
1540- {keep_state , State # raft_state {votes = maps : put ( NodeId , false , Votes ) }};
1540+ {keep_state , State # raft_state {votes = Votes #{ NodeId => false } }};
15411541
15421542% % [Handover RPC] Switch to follower because current term now has a leader (5.2, 5.3)
15431543candidate (Type , ? REMOTE (_Sender , ? HANDOVER (_Ref , _PrevLogIndex , _PrevLogTerm , _LogEntries )) = Event ,
@@ -2483,7 +2483,7 @@ heartbeat(?IDENTITY_REQUIRES_MIGRATION(_, FollowerId) = Sender,
24832483 ok ->
24842484 % pipelining - move NextIndex after sending out logs. If a packet is lost, follower's AppendEntriesResponse
24852485 % will return send back its correct index
2486- maps : put ( FollowerId , PrevLogIndex + length (Entries ) + 1 , NextIndex0 ) ;
2486+ NextIndex0 #{ FollowerId => PrevLogIndex + length (Entries ) + 1 } ;
24872487 _ ->
24882488 NextIndex0
24892489 end ,
0 commit comments