Skip to content

Conversation

vincent81jiang
Copy link
Contributor

@vincent81jiang vincent81jiang commented Nov 5, 2024

When loading transaction metadata from a transaction log partition, if the partition contains a segment ending with an empty batch, "currOffset" update logic at will be skipped for the last batch. Since "currOffset" is not advanced to next offset of last batch properly, TransactionStateManager.loadTransactionMetadata method will be stuck in the "while" loop.

This change fixes the issue by updating "currOffset" after processing each batch, whether the batch is empty or not.

@github-actions github-actions bot added core Kafka Broker small Small PRs labels Nov 5, 2024
@jolshan jolshan added the transactions Transactions and EOS label Nov 5, 2024
Copy link
Member

@jolshan jolshan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vincent81jiang
Please leave a description and let's make sure tests pass :)

@vincent81jiang
Copy link
Contributor Author

Thanks @vincent81jiang Please leave a description and let's make sure tests pass :)

@jolshan, thanks for the review. Description updated.

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vincent81jiang : Thanks for the PR. LGTM

I added a comment in #17193 (comment) to reduce the number of empty batches. But we can follow up on that separately.

@junrao junrao merged commit 08c876c into apache:trunk Nov 5, 2024
9 checks passed
@junrao junrao deleted the fix-kafka-17941 branch November 5, 2024 22:22
chiacyu pushed a commit to chiacyu/kafka that referenced this pull request Nov 30, 2024
…saction metadata (apache#17688)

When loading transaction metadata from a transaction log partition, if the partition contains a segment ending with an empty batch, "currOffset" update logic at will be skipped for the last batch. Since "currOffset" is not advanced to next offset of last batch properly, TransactionStateManager.loadTransactionMetadata method will be stuck in the "while" loop.

This change fixes the issue by updating "currOffset" after processing each batch, whether the batch is empty or not.

Reviewers: Justine Olshan <[email protected]>, Jun Rao <[email protected]>
tedyu pushed a commit to tedyu/kafka that referenced this pull request Jan 6, 2025
…saction metadata (apache#17688)

When loading transaction metadata from a transaction log partition, if the partition contains a segment ending with an empty batch, "currOffset" update logic at will be skipped for the last batch. Since "currOffset" is not advanced to next offset of last batch properly, TransactionStateManager.loadTransactionMetadata method will be stuck in the "while" loop.

This change fixes the issue by updating "currOffset" after processing each batch, whether the batch is empty or not.

Reviewers: Justine Olshan <[email protected]>, Jun Rao <[email protected]>
CalvinConfluent pushed a commit to CalvinConfluent/kafka that referenced this pull request Sep 12, 2025
…saction metadata (apache#17688)

When loading transaction metadata from a transaction log partition, if the partition contains a segment ending with an empty batch, "currOffset" update logic at will be skipped for the last batch. Since "currOffset" is not advanced to next offset of last batch properly, TransactionStateManager.loadTransactionMetadata method will be stuck in the "while" loop.

This change fixes the issue by updating "currOffset" after processing each batch, whether the batch is empty or not.

Reviewers: Justine Olshan <[email protected]>, Jun Rao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Kafka Broker small Small PRs transactions Transactions and EOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants