abhishekgupta-1 / CloudHaoma

Cloud Project (Distributed Storage)
1 stars 0 forks source link

Is votedFor == candidateId required? #2

Closed vidhiJain closed 7 years ago

vidhiJain commented 7 years ago

https://github.com/abhishekgupta-1/FUCloud/blob/2d36fe6f780a234158eafeadf379d7f263ff1a14/server.py#L170

vidhiJain commented 7 years ago

Are we assuming that the request from the same candidate may reach a node more than once?

abhishekgupta-1 commented 7 years ago

A Candidate requests vote only once for a term. The underlying communication layer may forward the same packet twice to a follower. In this case, the follower vote is counted twice. It may lead to two candidates to be elected to a term. We should only check for

votedFor == None

abhishekgupta-1 commented 7 years ago

Made the changes.