[ 
https://issues.apache.org/jira/browse/KAFKA-21000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18109365#comment-18109365
 ] 

Tushar Saini commented on KAFKA-21000:
--------------------------------------

Hi [~junrao] [~m1a2st] ,
I have opened a PR for this issue: https://github.com/apache/kafka/pull/23303
 
 
Please review when you have a chance. Thanks!

> Potential data corruption on clean broker restart
> -------------------------------------------------
>
>                 Key: KAFKA-21000
>                 URL: https://issues.apache.org/jira/browse/KAFKA-21000
>             Project: Kafka
>          Issue Type: Improvement
>          Components: core
>            Reporter: Jun Rao
>            Assignee: Ken Huang
>            Priority: Major
>
> A similar issue to https://issues.apache.org/jira/browse/KAFKA-20979 could be 
> exposed in the .log file when preallocation is used.
> When the active segment is closed, FileRecords.close() calls the following.
> {code:java}
> flush();
> trim();{code}
> When preallocation is used, trim() resizes the file length to what's actually 
> being used, but without flushing the length metadata. The broker cleanly 
> shuts down and crashes before the metadata is flushed. When the broker is 
> restarted, the on-disk file length still has the preallocation length but 
> won't go through recovery (since the broker was shutdown cleanly). When the 
> broker tries to calculate the next offset, it will hit the uninitialized 
> bytes and cause an exception.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to