divijvaidya commented on PR #14439:
URL: https://github.com/apache/kafka/pull/14439#issuecomment-1738833954

   Let me try to understand the situation here before I look into the code 
change.
   
   1. Leader A has a segment with offsets [1-3]. It expires this segment and 
moves global start offset to let's say 4. It's next available segment starts 
from [4-10].
   2. B has a segment with offsets from [2-10].
   3. Leader A tells about the global start offset to B (as part of fetch) and 
B set's the global start offset value internally to 4. B should also set it's 
local log start offset to 4 (even if it has a segment which begins at 2).
   4. Leadership moves to B.
   
   Earlier we were checking that global start offset (4) is equal to base 
offset of first segment (2). Which is incorrect as per the above case. Instead, 
now as a correction, we should check that end offset of first segment (locally) 
is less than global log start offset (4). This will assert that the first 
segment has a right to exist since it still contains active offsets.
   
   Is my understanding right?


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