haung921209 opened a new pull request, #23202:
URL: https://github.com/apache/kafka/pull/23202

   LocalLeaderEndPoint falls back to epoch 0 when the leader epoch cache cannot
   resolve an epoch for the queried offset, while RemoteLeaderEndPoint (via
   ListOffsets) reports -1 in the same case. Epoch 0 is meaningful to
   TierStateMachine#buildRemoteLogAuxState, which short-circuits the
   earlier-epoch lookup on epoch 0 instead of failing the aux state build
   explicitly. This PR aligns the local path with the remote one by falling back
   to UNDEFINED_EPOCH (-1) in the four offset fetch methods, and adds a unit
   test that exercises the unresolvable-epoch case for all four.
   
   Jira: https://issues.apache.org/jira/browse/KAFKA-20770
   
   ### Testing
   
   - New unit test `testFetchOffsetsReturnUndefinedEpochWhenEpochIsUnresolvable`
     fails before the fix (`expected epoch=-1 but was epoch=0`) and passes 
after.
   - Targeted suites green: LocalLeaderEndPointTest, RemoteLeaderEndPointTest,
     ReplicaAlterLogDirsThreadTest, AbstractFetcherThreadTest,
     TierStateMachineTest, ReplicaFetcherThreadTest (156 tests, 0 failures).
   


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