kowshik opened a new pull request #10888:
URL: https://github.com/apache/kafka/pull/10888


   Within `LogLoader.removeAndDeleteSegmentsAsync()`, we should force 
materialization of the `segmentsToDelete` iterable, to make sure the results of 
the iteration remain valid and deterministic. We should also pass only the 
materialized view to the logic that deletes the segments.
   
   **Tests:**
   Added the missing unit test coverage to 
`LogLoaderTest.testLogEndLessThanStartAfterReopen()`.
   Previously the test was in `LogTest` suite but it has been moved over now to 
`LogLoaderTest` suite, as it deserves to be there instead.
   This test fails without the fix, but passes with this fix:
   ```
   @Test
   def testLogEndLessThanStartAfterReopen(): Unit = {
      ...
      ...
      ...
      // Validate that the remaining segment matches our expectations
      val onlySegment = log.segments.firstSegment.get
      assertEquals(startOffset, onlySegment.baseOffset)
      assertTrue(onlySegment.log.file().exists())
      assertTrue(onlySegment.lazyOffsetIndex.file.exists())
      assertTrue(onlySegment.lazyTimeIndex.file.exists())
   }
   ```
   


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