ccding opened a new pull request #11345:
URL: https://github.com/apache/kafka/pull/11345


   Within a LogSegment, the TimeIndex and OffsetIndex are lazy indices that 
don't get created on disk until they are accessed for the first time. However, 
Log recovery logic expects the presence of offset index file on disk for each 
segment, otherwise the segment is considered corrupted.
   
   Author:    Kowshik Prakasam <kpraka...@confluent.io>
   
   **Note:**
   
   Per an offline discussion, I am submitting this PR written by Kowshik. "I" 
in the following text refers to Kowshik.
   
   **Tests:**
   
   It was super hard to write a unit test for this since LogSegment.open calls 
could not be mocked. Instead, I tested this on my cluster. Before this PR, I 
noticed that for several topic partitions that had empty active segments and 
missing offset index files on disk, a broker restart resulted in the error 
message: Could not find offset index file.... But after I deployed this PR, I 
noticed that the error message was gone.
   
   ### 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 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


Reply via email to