[ https://issues.apache.org/jira/browse/KAFKA-19474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18003710#comment-18003710 ]
Rajani Karuturi commented on KAFKA-19474: ----------------------------------------- created a PR https://github.com/apache/kafka/pull/20125 for the fix Also added a test to test a scenario where HWM is changed > Wrong placement of WARN log for truncation below HWM > ---------------------------------------------------- > > Key: KAFKA-19474 > URL: https://issues.apache.org/jira/browse/KAFKA-19474 > Project: Kafka > Issue Type: Bug > Components: core > Affects Versions: 2.1.0, 4.0.0, 4.1.0 > Reporter: Gaurav Narula > Assignee: Gaurav Narula > Priority: Major > > {{ReplicaFetcherThread#truncate}} has a useful [WARN > log|https://github.com/apache/kafka/blob/da4fbba2793528e283458e080a690ad141857b0b/core/src/main/scala/kafka/server/ReplicaFetcherThread.scala#L171] > when a follower is truncating its log segment below its HWM. > This is of particular help when debugging data loss scenarios like those > described in the motivation for > [KIP-966|https://cwiki.apache.org/confluence/display/KAFKA/KIP-966%3A+Eligible+Leader+Replicas]. > Unfortunately, a refactoring in [PR > 5608|https://github.com/apache/kafka/pull/5608/files#diff-693a5eaaaa4fe61a18af23d5b06ccc024261dda01558cbaacb7020e1911c6d55R264] > moved the check to _after_ the truncation, which may modify the HWM. As a > result, the log may not be emitted even though the log is truncated below the > HWM -- This message was sent by Atlassian Jira (v8.20.10#820010)