yyu1993 opened a new pull request #11950:
URL: https://github.com/apache/kafka/pull/11950


   In the log layer, if all segments from a log are deleted before a new 
segment is created, the log will have no active segment for a brief time. This 
will allows for a race condition to happen if other threads are reading the 
active segment at the same time which will can result in a 
NoSuchElementException.
   
   This PR:
   - introduces a new function which creates a new segment and then deletes the 
given segment. This would ensure the log will have an active segment at all 
times.
   - fixes two places where segments are deleted before new segment is created.
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to