splett2 commented on code in PR #14053: URL: https://github.com/apache/kafka/pull/14053#discussion_r1324902142
########## core/src/main/scala/kafka/cluster/Partition.scala: ########## @@ -864,13 +866,19 @@ class Partition(val topicPartition: TopicPartition, // No need to calculate low watermark if there is no delayed DeleteRecordsRequest val oldLeaderLW = if (delayedOperations.numDelayedDelete > 0) lowWatermarkIfLeader else -1L val prevFollowerEndOffset = replica.stateSnapshot.logEndOffset - replica.updateFetchState( - followerFetchOffsetMetadata, - followerStartOffset, - followerFetchTimeMs, - leaderEndOffset, - brokerEpoch - ) + + // Apply read lock here to avoid the race between ISR updates and the fetch requests from rebooted follower. It + // could break the broker epoch checks in the ISR expansion. + inReadLock(leaderIsrUpdateLock) { Review Comment: I think we should pass through the fetch request leader epoch and validate that it is still valid as well. Otherwise we can end up with a stale fetch updating the replica state for a new epoch. It may not be necessary to do it in this PR though. @dajac wdyt -- 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