You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ratis.apache.org by Asad Awadia <as...@gmail.com> on 2022/08/22 21:04:12 UTC
Leader down while replicating
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?
Re: Leader down while replicating
Posted by Tsz Wo Sze <sz...@gmail.com>.
In this case, the 2 nodes are not yet added since the setConf entry
must have index > 10 so that it cannot be committed. If the original
Leader goes down, the setConf cannot succeed.
Tsz-Wo
On Mon, Aug 22, 2022 at 7:35 PM Asad Awadia <as...@gmail.com> wrote:
>
>
> "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"
>
> Entries 7-10 are committed because the group started with just 1 node which had majority of 1
>
> Aftet that 2 blank nodes were added
>
> On Mon., Aug. 22, 2022, 10:27 p.m. Tsz Wo Sze, <sz...@gmail.com> wrote:
>>
>> 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 <as...@gmail.com> 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?
Re: Leader down while replicating
Posted by Asad Awadia <as...@gmail.com>.
"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"
Entries 7-10 are committed because the group started with just 1 node which
had majority of 1
Aftet that 2 blank nodes were added
On Mon., Aug. 22, 2022, 10:27 p.m. Tsz Wo Sze, <sz...@gmail.com> wrote:
> 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 <as...@gmail.com> 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?
>
Re: Leader down while replicating
Posted by Tsz Wo Sze <sz...@gmail.com>.
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 <as...@gmail.com> 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?