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

ASF GitHub Bot commented on KAFKA-6492:
---------------------------------------

hachikuji opened a new pull request #4498: KAFKA-6492: Fix log truncation to 
empty segment
URL: https://github.com/apache/kafka/pull/4498
 
 
   This patch ensures that truncation to an empty segment forces resizing of 
the index file in order to prevent premature rolling.
   
   I have added unit tests which verify that appends are permitted following 
truncation to an empty segment. Without the fix, this test case reproduces the 
failure in which the rolled segment matches the current active segment.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> LogSemgent.truncateTo() should always resize the index file
> -----------------------------------------------------------
>
>                 Key: KAFKA-6492
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6492
>             Project: Kafka
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.0.0
>            Reporter: Jiangjie Qin
>            Priority: Major
>             Fix For: 1.1.0
>
>
> The bug is the following:
>  # Initially on a follower broker there are two segments 0 and segment 10000. 
> Segment 0 is empty (maybe due to log compaction)
>  # log is truncated to 0.
>  # LogSemgent.Truncate() will not find a message to truncate in segment 0, so 
> it will skip resizing the index/timeindex files. 
>  # When a new message is fetched, Log.maybeRoll() will try to roll a new 
> segment because the index file of segment 0 is already full (max size is 0)
>  # After creating the new segment 0, the replica fetcher thread finds that 
> there is already a segment 0 exists. So it just throws exception and dies.
> The fix would be let the broker make sure the index files of active segments 
> are always resized properly.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to