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 2023/05/06 04:28:30 UTC

Term mismatch on log

Hello,

What is the behaviour when the follower receives a log where the term in
the request log is different than the local term on the node?

Is the follower node permenanty stuck there?

Is it valid to delete this entry?

Regards,
Asad

Re: Term mismatch on log

Posted by Tsz Wo Sze <sz...@gmail.com>.
Hi Asad,

I guess you mean that the follower receives an appendEntries request from
the leader.  A log entry with index i in the request has a different term
than the stored index i entry.  In such cases, the follower will truncate
the log.

See
https://github.com/apache/ratis/blob/master/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLogCache.java#L605

This case is possible since the follower could have some uncommitted
entries in its log received from the previous leader (or received from a
client if this follower was the previous leader).  Since the entries are
uncommitted, they can be safely truncated.

Tsz-Wo


On Fri, May 5, 2023 at 9:28 PM Asad Awadia <as...@gmail.com> wrote:

> Hello,
>
> What is the behaviour when the follower receives a log where the term in
> the request log is different than the local term on the node?
>
> Is the follower node permenanty stuck there?
>
> Is it valid to delete this entry?
>
> Regards,
> Asad
>