dengziming commented on code in PR #13845: URL: https://github.com/apache/kafka/pull/13845#discussion_r1228931662
########## raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java: ########## @@ -1017,7 +1017,16 @@ private FetchResponseData tryCompleteFetchRequest( long fetchOffset = request.fetchOffset(); int lastFetchedEpoch = request.lastFetchedEpoch(); LeaderState<T> state = quorum.leaderStateOrThrow(); - ValidOffsetAndEpoch validOffsetAndEpoch = log.validateOffsetAndEpoch(fetchOffset, lastFetchedEpoch); + + Optional<OffsetAndEpoch> latestSnapshotId = log.latestSnapshotId(); + final ValidOffsetAndEpoch validOffsetAndEpoch; + if (fetchOffset == 0 && latestSnapshotId.isPresent()) { Review Comment: I have tried to figure out some other cases we prefer to read the snapshot, a common case is `highWatermark` - `fetchOffset` > count(snapshot record). Do you think it's possible to write count(snapshot record) in the snapshot header? -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org