You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/02/11 16:14:16 UTC

[GitHub] [kafka] mumrah commented on a change in pull request #10097: MINOR: Add FetchSnapshot API doc in KafkaRaftClient

mumrah commented on a change in pull request #10097:
URL: https://github.com/apache/kafka/pull/10097#discussion_r574630121



##########
File path: raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java
##########
@@ -126,9 +126,16 @@
  *    gracefully resign from the current epoch. This causes remaining voters to immediately
  *    begin a new election.
  *
- * 4) {@link FetchRequestData}: This is the same as the usual Fetch API in Kafka, but we piggyback
- *    some additional metadata on responses (i.e. current leader and epoch). Unlike partition replication,
- *    we also piggyback truncation detection on this API rather than through a separate truncation state.
+ * 4) {@link FetchRequestData}: This is the same as the usual Fetch API in Kafka, but we add snapshot
+ *    check before responding, and we also piggyback some additional metadata on responses (i.e. current
+ *    leader and epoch). Unlike partition replication, we also piggyback truncation detection on this API
+ *    rather than through a separate truncation state.
+ *
+ * 5) {@link FetchSnapshotRequestData}: Sent by the follower to the epoch leader to fetch snapshot when
+ *    FetchResponse include a snapshot id, this happens when the follower's log end offset is less than
+ *    the leader's log start offset. This is similar to the Fetch API since the snapshot is also stored
+ *    as FileRecords, but we use {@link UnalignedRecords} in FetchSnapshotResponse because the records is
+ *    not necessarily offset-aligned.

Review comment:
       ```suggestion
    * 5) {@link FetchSnapshotRequestData}: Sent by the follower to the epoch leader in order to fetch a snapshot.
    *    This happens when a FetchResponse includes a snapshot ID due to the follower's log end offset being less
    *    than the leader's log start offset. This API is similar to the Fetch API since the snapshot is stored
    *    as FileRecords, but we use {@link UnalignedRecords} in FetchSnapshotResponse because the records
    *    are not necessarily offset-aligned.
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org