You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "xuzq (JIRA)" <ji...@apache.org> on 2017/05/25 15:05:04 UTC

[jira] [Comment Edited] (KAFKA-5326) Log offset index resize cause empty index file

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

xuzq edited comment on KAFKA-5326 at 5/25/17 3:04 PM:
------------------------------------------------------

When the kafka server is running, someone removed the index file on the disk manually, if at this point, the function AbstractIndex.Resize(newSize: Int) is triggered, will create a new ".index" file which the size is "roundedNewSize", but the content is empty.

I think if the ".index" is not exist, we should copy the contents from old "mmap" to new "mmap" to avoid the "empty file".


was (Author: xuzq_zander):
When the kafka server is running, someone removed the index file on the disk manually, if at this point, the function AbstractIndex.Resize(newSize: Int) is triggered, will create a new ".index" file which the size is "roundedNewSize", but the content is empty.

> Log offset index  resize cause empty  index file
> ------------------------------------------------
>
>                 Key: KAFKA-5326
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5326
>             Project: Kafka
>          Issue Type: Bug
>          Components: core, log
>    Affects Versions: 0.10.2.1
>            Reporter: Ma Tianchi
>
> After a log index file lost or be removed when kafka server is running,then some one calls OffsetIndex.resize(newSize: Int) .It will cause a new index file be created but there is no values in it,even though the size is same with old one.
> It will do something as below. 
> val raf = new RandomAccessFile(file, "rw")
> This time file does not exit.It will create a new file.
> Then at:
> mmap = raf.getChannel().map(FileChannel.MapMode.READ_WRITE, 0, roundedNewSize)
> The mmap is created from new file which is empty.
> and then:
> mmap.position(position)
> This make the new index file which size is same with old index file,but there is nothing in it.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)