Fix IllegalStateException for Transaction Producer
Current Behavior:
- When a batch fails with a fatal error (e.g., ProducerFencedException), the TM transitions to FATAL state
- However, subsequent batches that fail can still trigger state transitions through code path
Sender.failBatch -> TM.handleFailedBatch > TM.maybeTransitionToErrorState - This means that even after entering FATAL state, other batches could potentially transition the TM to ABORTABLE state
Example Scenario:
Batch 1 fails with ProducerFencedException
↓
TM transitions to FATAL state
↓
Batch 2 fails with UnknownProducerIdException
↓
TM incorrectly transitions to ABORTABLE state (this is the bug)
A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.
This PR is being marked as stale since it has not had any activity in 90 days. If you would like to keep this PR alive, please leave a comment asking for a review. If the PR has merge conflicts, update it with the latest from the base branch.
If you are having difficulty finding a reviewer, please reach out on the [mailing list](https://kafka.apache.org/contact).
If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.
A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.
@jolshan—can you review this PR? Thanks 😄
@k-raina—can you push an empty commit to this branch so it triggers a build? Thanks!
@k-raina—Also, can you mark it as "ready to review?" I just realized it's still in draft mode.
A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.
This PR is being marked as stale since it has not had any activity in 90 days. If you would like to keep this PR alive, please leave a comment asking for a review. If the PR has merge conflicts, update it with the latest from the base branch.
If you are having difficulty finding a reviewer, please reach out on the [mailing list](https://kafka.apache.org/contact).
If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.
A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.