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

   ## Description
   
   `ProducerAppendInfo.checkSequence` previously rejected a non-zero base 
sequence only when the producer state entry existed and supported epoch bumping 
(the transactions v2 path), and accepted any sequence when there was no 
producer state at all. This change replaces that logic so that any batch 
arriving with no producer state must start at sequence 0, regardless of whether 
the entry supports epoch bumping, and throws `UnknownProducerIdException` 
instead of `OutOfOrderSequenceException` in that case. The existing in-sequence 
check for the no-current-epoch case is also removed, since the new rule makes 
it unnecessary.
   
   Corresponding test updates:
   
   - `ProducerStateManagerTest.testReloadSnapshots` is corrected to use 
sequence 0 as the first sequence for a fresh producer instead of 1.
   - The two tests covering producer-id expiration and `truncateAndReload` no 
longer expect a non-zero sequence to be accepted on a producer with no state; 
instead they expect `UnknownProducerIdException`, and the subsequent successful 
append uses a bumped epoch starting at sequence 0.
   - `testRejectNonZeroSequenceForTransactionsV2WithEmptyState` is renamed to 
`testRejectNonZeroSequenceForClientAppendWithEmptyState` and exercises the new 
`UnknownProducerIdException` behavior; 
`testAllowNonZeroSequenceForTransactionsV1WithEmptyState` is updated to use the 
transactions v1 verification entry.
   - `UnifiedLogTest` is updated to expect `UnknownProducerIdException` instead 
of `OutOfOrderSequenceException` for the transactional append with no producer 
state.
   
   ### Test Plan
   
   Unit tests in `ProducerStateManagerTest` and `UnifiedLogTest` were updated 
and pass with the new validation behavior.
   
   JIRA: https://issues.apache.org/jira/browse/KAFKA-19880


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