On 12/17/25 3:31 AM, Han Zhou wrote:
> 
> 
> On Tue, Dec 16, 2025 at 12:34 PM Ilya Maximets <[email protected] 
> <mailto:[email protected]>> wrote:
>>
>> I am not sure how we could receive a pre-vote reply for a term of the
>> actual vote, but if somehow it does happen, we must not accept it, as
>> the same server can vote differently in the pre-vote and the real vote
>> and so we may end up with more than one elected leader.
>>
>> Ignore the pre-vote reply during the actual elections and warn the user
>> if this ever happens, so we could investigate further.
>>
>> Found while investigating a report with a cluster with two elected
>> leaders.  It may not be the cause of the issue and, as stated above,
>> I'm not even sure if receiving a pre-vote for the actual election term
>> is possible.  But it's better to cover this case explicitly, as the
>> flag in the reply is not used today.
> 
> Thanks Ilya. I can't think of how this could happen either, because a pre-vote
> reply for term T should already be rejected by raft_receive_term__() in
> raft_handle_vote_reply() since we're now at term T+1 for the real vote, but
> I agree with this patch as a defensive check.
> 
> Probably it would be good to add a comment in the code to explain this is
> a defensive check for an unknown edge case.
> 
> Acked-by: Han Zhou <[email protected]>

Thanks!  I can add a comment like this:

+        /* This is mostly a defensive check, as pre-vote and a vote should
+         * not happen on the same term.  But we'd like to know if they do. */

What do you think?

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to