[ 
https://issues.apache.org/jira/browse/KAFKA-10800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17326611#comment-17326611
 ] 

Haoran Xuan commented on KAFKA-10800:
-------------------------------------

Hi, [~jagsancio], I just started working on this task, and want to make sure I 
have the correct understanding before going too far.

---------

"When the state machine attempts to create a snapshot writer we should validate 
that the following is true:
 # The end offset and epoch of the snapshot is less than the high-watermark.
 # The end offset and epoch of the snapshot is valid based on the leader epoch 
cache.

Note that this validation should not be performed when the raft client creates 
the snapshot writer because in that case the local log is out of date and the 
follower should trust the snapshot id sent by the partition leader."

--------

Questions are:

1) What does "the state machine" mean here?  I assume it's the KafkaRaftClient? 
And "attempts to create a snapshot writer", I assume this refers to 
`log.createSnapshot(snapshotId)`?

2) "The end offset and epoch of the snapshot is less than the high-watermark", 
does the "high-watermark" refer to the leader's highwatermark or the follower's 
highwatermark? If it is the former, shouldn't it be the leader's responsibility 
to satisfy this ? If it's the latter, then I think the snapshotId can actually 
be larger than itself's highwatermark, say the follower has been lagged too 
much, and its highwatermark == its logEndOffset, which is smaller than the 
leader's logStartOffset, in this case, the follower's highwatermark will be 
updated to the snapshotId's endOffset when the snapshot fetching has completed, 
did I miss anything?

3) "validation should not be performed when the raft client creates the 
snapshot writer ", if my assumption in Question 1) is correct, then this seems 
to be in conflict with 1)

 

Thanks!

 

 

> Validate the snapshot id when the state machine creates a snapshot
> ------------------------------------------------------------------
>
>                 Key: KAFKA-10800
>                 URL: https://issues.apache.org/jira/browse/KAFKA-10800
>             Project: Kafka
>          Issue Type: Sub-task
>          Components: replication
>            Reporter: Jose Armando Garcia Sancio
>            Assignee: Haoran Xuan
>            Priority: Major
>
> When the state machine attempts to create a snapshot writer we should 
> validate that the following is true:
>  # The end offset and epoch of the snapshot is less than the high-watermark.
>  # The end offset and epoch of the snapshot is valid based on the leader 
> epoch cache.
> Note that this validation should not be performed when the raft client 
> creates the snapshot writer because in that case the local log is out of date 
> and the follower should trust the snapshot id sent by the partition leader.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to