Hi Asad, If the group has 3 nodes, then the log entries in the leader A are not yet committed since the entries 7-10 have not replicated to a majority of nodes. The entries 7-10 can be either committed later or safely thrown away:
- If A becomes the leader again, it will resend the entries 7-10 to the followers. - Suppose 2 nodes B and C have voted a new leader among themselves. The new leader, say B, will first record a new log entry 7' for starting a new term and send it to C. Once C has received 7', the entry becomes committed. When A rejoins the group, A must truncate its log and throw away entries 7-10. Hope it helps. Tsz-Wo On Mon, Aug 22, 2022 at 2:04 PM Asad Awadia <[email protected]> wrote: > > Hello, > > What happens if the leader goes down while the follower nodes are still > catching up (like after just starting up) > > Eg > 1 node is the leader and has logs from 0-10 > 2 nodes join and start replicating the log > After the 2 follower nodes get to log index 6 > The leader goes down > What happens to the log entries from 7-10? > Are they thrown away? Now the new leader will overwrite?
