@@ -3726,6 +3726,24 @@ CONTINUE:
37263726 }
37273727 }
37283728
3729+ // ae should no longer be used after this call as
3730+ // processEntriesAndCommit may return the appendEntry back to its pool
3731+ n .processEntriesAndCommit (ae , isNew )
3732+
3733+ // Only ever respond to new entries.
3734+ // Never respond to catchup messages, because providing quorum based on this is unsafe.
3735+ // The only way for the leader to receive "success" MUST be through this path.
3736+ if sub != nil && isNew {
3737+ // Success. Send our response.
3738+ return newAppendEntryResponse (n .pterm , n .pindex , n .id , true )
3739+ }
3740+
3741+ return nil
3742+ }
3743+
3744+ // Process all entries in appendEntry and try to commit.
3745+ // Lock should be held.
3746+ func (n * raft ) processEntriesAndCommit (ae * appendEntry , isNew bool ) {
37293747 // Check to see if we have any related entries to process here.
37303748 for _ , e := range ae .entries {
37313749 switch e .Type {
@@ -3780,16 +3798,6 @@ CONTINUE:
37803798 }
37813799 }
37823800 }
3783-
3784- // Only ever respond to new entries.
3785- // Never respond to catchup messages, because providing quorum based on this is unsafe.
3786- // The only way for the leader to receive "success" MUST be through this path.
3787- if sub != nil && isNew {
3788- // Success. Send our response.
3789- return newAppendEntryResponse (n .pterm , n .pindex , n .id , true )
3790- }
3791-
3792- return nil
37933801}
37943802
37953803// resetInitializing resets the notion of initializing.
0 commit comments