karuturi opened a new pull request, #20125: URL: https://github.com/apache/kafka/pull/20125
The `ReplicaFetcherThread#truncate` method includes a WARN log to detect when a follower truncates its log to an offset below the current high watermark. This is a useful diagnostic for potential data loss scenarios. A previous refactoring moved the high watermark check to after the call to `partition.truncateTo()`. However, the `truncateTo()` operation can itself update the high watermark. This created a condition where the check would compare the truncation offset against the *new* high watermark, often preventing the warning from being logged when it should have been. This commit fixes the issue by moving the high watermark check to before the `partition.truncateTo()` call, ensuring the comparison happens against the correct HWM value at the time of truncation. Delete this text and replace it with a detailed description of your change. The PR title and body will become the squashed commit message. If you would like to tag individuals, add some commentary, upload images, or include other supplemental information that should not be part of the eventual commit message, please use a separate comment. If applicable, please include a summary of the testing strategy (including rationale) for the proposed change. Unit and/or integration tests are expected for any behavior change and system tests should be considered for larger changes. -- 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