soarez commented on pull request #10650:
URL: https://github.com/apache/kafka/pull/10650#issuecomment-846136326


   @ijuma I can see it makes to not hide the underlying issue. But at the 
moment, the exception provides no helpful information either. What do you think 
about adding the topic name and partition number to the exception message when 
this failure happens?
   
   @kowshik No. This is a tricky one to reproduce, it looks like a race 
condition. However, there are some clues about what happened.
   
   The exception happened shortly after the broker that had been offline for 
over a week was started again in a busy cluster. And just before this 
`NoSuchElementException` was thrown there were many warnings of this sort:
   
   ```
   [Log partition=foo-1, dir=/d3/data] Could not find offset index file 
corresponding to log file /d3/data/foo-1/00000000000003424067.log, recovering 
segment and rebuilding index files...
   ```
   
   Looking at the 2.6.2 source, this message is only produced in 
[`Log.loadSegmentFiles`](https://github.com/apache/kafka/blob/25f4b2337d8199cd1420516c2a817d2e0d878cb4/core/src/main/scala/kafka/log/Log.scala#L624),
 which is only called from 
[`Log.loadSegments`](https://github.com/apache/kafka/blob/25f4b2337d8199cd1420516c2a817d2e0d878cb4/core/src/main/scala/kafka/log/Log.scala#L713).
 And right before that call there is a 
[`segments.clear()`](https://github.com/apache/kafka/blob/25f4b2337d8199cd1420516c2a817d2e0d878cb4/core/src/main/scala/kafka/log/Log.scala#L712)
 which will cause 
[`logSegments`](https://github.com/apache/kafka/blob/25f4b2337d8199cd1420516c2a817d2e0d878cb4/core/src/main/scala/kafka/log/Log.scala#L2144)
 to be empty. I think that's how this happened.
   
   Looking at `trunk` the [segments are also 
cleared](https://github.com/apache/kafka/blob/0b464419e2e4f28444fca653ae5aa8dd7feae9ba/core/src/main/scala/kafka/log/LogLoader.scala#L105-L106)
 in the same way.
   
   
   


-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to