File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1787,8 +1787,15 @@ func stepLeader(r *raft, m pb.Message) error {
17871787 bucket = make (map [string ]pb.Entry )
17881788 r .proposalCache [m .Index ] = bucket
17891789 }
1790+
1791+ // Local self-proposals come in with From=None (0); treat as leader.
1792+ from := m .From
1793+ if from == None {
1794+ from = r .id
1795+ }
1796+
17901797 // Leader-preferred caching: our own payload must win to preserve Header.ID.
1791- if m . From == r .id {
1798+ if from == r .id {
17921799 bucket [cid ] = e
17931800 } else {
17941801 if _ , ok := bucket [cid ]; ! ok {
@@ -1797,10 +1804,10 @@ func stepLeader(r *raft, m pb.Message) error {
17971804 }
17981805
17991806 // classic-fallback when mixed cluster can't produce fast-vote CQ.
1800- // If this is the next index k and we haven't installed a leader-approved entry yet,
1807+ // If this is OUR fast-prop for the next index k and we haven't installed a leader-approved entry yet,
18011808 // pick this payload and replicate classically. First-wins policy is fine.
18021809 k := r .raftLog .committed + 1
1803- if m .Index == k && ! r .hasLeaderApprovedAt (k ) {
1810+ if from == r . id && m .Index == k && ! r .hasLeaderApprovedAt (k ) {
18041811 // Materialize leader-approved entry from the cached payload.
18051812 chosen := bucket [cid ]
18061813 setOrigin (& chosen , pb .EntryOriginLeader ) // leader canon
You can’t perform that action at this time.
0 commit comments