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

Tm Alkemade edited comment on KAFKA-13773 at 3/30/22, 2:03 PM:
---------------------------------------------------------------

[~showuon] I ran additional tests on 2.6.0 2.7.0 and 2.8.0. I was not able to 
reproduce it on 2.6.0 and 2.7.0, however 2.8.0 does have the issue.

[~junrao] You're right, log recovery seems to be skipped in 2.8.0, I've 
attached a new zip file with the logs from 2.7.0 and 2.8.0 at the first startup 
after the disk resize. The 2.7.0 logs have a log recovery step, however the 
2.8.0 logs contain: 
{code:java}
2022-03-30 13:25:52,577 INFO Skipping recovery for all logs in 
/var/lib/kafka/data-0/kafka-log2 since clean shutdown file was found 
(kafka.log.LogManager) [main] {code}
It should be mentioned that since this is on Kubernetes, there are several 
attempts to restart the Kafka pod where Kafka tries, and fails, to start. 
Perhaps the clean shutdown file is created in one of these restarts. The new 
zip also contains the log of one of the failed restarts. Unfortunately its hard 
for me to get the log for the first failed restart.

I've also added a zipfile of the actual crash in case its useful.

 


was (Author: JIRAUSER287208):
[~showuon] I ran additional tests on 2.6.0 2.7.0 and 2.8.0. I was not able to 
reproduce it on 2.6.0 and 2.7.0, however 2.8.0 does have the issue.

[~junrao] You're right, log recovery seems to be skipped in 2.8.0, I've 
attached a new zip file with the logs from 2.7.0 and 2.8.0 at the first startup 
after the disk resize. The 2.7.0 logs have a log recovery step, however the 
2.8.0 logs contain: 
{code:java}
2022-03-30 13:25:52,577 INFO Skipping recovery for all logs in 
/var/lib/kafka/data-0/kafka-log2 since clean shutdown file was found 
(kafka.log.LogManager) [main] {code}
It should be mentioned that since this is on Kubernetes, there are several 
attempts to restart the Kafka pod where Kafka tries, and fails, to start. 
Perhaps the clean shutdown file is created in one of these restarts. The new 
zip also contains the log of one of the failed restarts. Unfortunately its hard 
for me to get the log for the first failed restart. I've also noticed that the 
clean shutdown file is contained in the 'kafka-.zip' file I attached, even 
though those files were taken before resizing the data disk.

I've also added a zipfile of the actual crash in case its useful.

 

> Data loss after recovery from crash due to full hard disk
> ---------------------------------------------------------
>
>                 Key: KAFKA-13773
>                 URL: https://issues.apache.org/jira/browse/KAFKA-13773
>             Project: Kafka
>          Issue Type: Bug
>          Components: log cleaner
>    Affects Versions: 3.1.0, 2.8.1
>            Reporter: Tm Alkemade
>            Priority: Major
>         Attachments: DiskAndOffsets.png, kafka-.zip, kafka-2.7.0vs2.8.0.zip, 
> kafka-2.8.0-crash.zip, kafka-logfiles.zip
>
>
> While doing some testing of Kafka on Kubernetes, the data disk for kafka 
> filled up, which led to all 3 nodes crashing. I increased the disk size for 
> all three nodes and started up kafka again (one by one, waiting for the 
> previous node to become available before starting the next one). After a 
> little while two out of three nodes had no data anymore.
> According to the logs, the log cleaner kicked in and decided that the latest 
> timestamp on those partitions was '0' (i.e. 1970-01-01), and that is older 
> than the 2 week limit specified on the topic.
>  
> {code:java}
> 2022-03-28 12:17:19,740 INFO [LocalLog partition=audit-trail-0, 
> dir=/var/lib/kafka/data-0/kafka-log1] Deleting segment files 
> LogSegment(baseOffset=0, size=249689733, lastModifiedTime=1648460888636, 
> largestRecordTimestamp=Some(0)) (kafka.log.LocalLog$) [kafka-scheduler-0]
> 2022-03-28 12:17:19,753 INFO Deleted log 
> /var/lib/kafka/data-0/kafka-log1/audit-trail-0/00000000000000000000.log.deleted.
>  (kafka.log.LogSegment) [kafka-scheduler-0]
> 2022-03-28 12:17:19,754 INFO Deleted offset index 
> /var/lib/kafka/data-0/kafka-log1/audit-trail-0/00000000000000000000.index.deleted.
>  (kafka.log.LogSegment) [kafka-scheduler-0]
> 2022-03-28 12:17:19,754 INFO Deleted time index 
> /var/lib/kafka/data-0/kafka-log1/audit-trail-0/00000000000000000000.timeindex.deleted.
>  (kafka.log.LogSegment) [kafka-scheduler-0]{code}
> Using kafka-dump-log.sh I was able to determine that the greatest timestamp 
> in that file (before deletion) was actually 1648460888636 ( 2022-03-28, 
> 09:48:08 UTC, which is today). However since this segment was the 
> 'latest/current' segment much of the file is empty. The code that determines 
> the last entry (TimeIndex.lastEntryFromIndexFile)  doesn't seem to know this 
> and just read the last position in the file, the file being mostly empty 
> causes it to read 0 for that position.
> The cleaner code seems to take this into account since 
> UnifiedLog.deleteOldSegments is never supposed to delete the current segment, 
> judging by the scaladoc, however in this case the check doesn't seem to do 
> its job. Perhaps the detected highWatermark is wrong?
> I've attached the logs and the zipped data directories (data files are over 
> 3Gb in size when unzipped)
>  
> I've encountered this problem with both kafka 2.8.1 and 3.1.0.
> I've also tried changing min.insync.replicas to 2: The issue still occurs.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to