[ 
https://issues.apache.org/jira/browse/KAFKA-17941?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vincent Jiang updated KAFKA-17941:
----------------------------------
    Description: 
When loading transaction metadata from a transaction log partition, if the 
partition contains a segment ending with an empty batch, "currOffset" update 
logic at 
[https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/coordinator/transaction/TransactionStateManager.scala#L482]
 will be skipped.  Since "currOffset" is not advanced to next offset of last 
batch properly, TransactionStateManager.loadTransactionMetadata method will be 
stuck in the "while" loop at 
[https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/coordinator/transaction/TransactionStateManager.scala#L438.|https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/coordinator/transaction/TransactionStateManager.scala#L438,]
 

After the change of https://issues.apache.org/jira/browse/KAFKA-17076, there is 
a higher chance for compaction process to generate segments ending with an 
empty batch. As a result, this issue is more likely to be hit now comparing to 
before KAFKA-17076 change.

  was:When loading transaction metadata from a transaction log partition, if 
the partition contains a segment ending with an empty batch, "currOffset" 
update logic at 
[https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/coordinator/transaction/TransactionStateManager.scala#L482]
 will be skipped.  Since "currOffset" is not advanced to next offset of last 
batch properly, TransactionStateManager.loadTransactionMetadata method will be 
stuck in the "while" loop at 
[https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/coordinator/transaction/TransactionStateManager.scala#L438.|https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/coordinator/transaction/TransactionStateManager.scala#L438,]
 


> TransactionStateManager.loadTransactionMetadata method may get stuck in an 
> infinite loop
> ----------------------------------------------------------------------------------------
>
>                 Key: KAFKA-17941
>                 URL: https://issues.apache.org/jira/browse/KAFKA-17941
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Vincent Jiang
>            Assignee: Vincent Jiang
>            Priority: Major
>
> When loading transaction metadata from a transaction log partition, if the 
> partition contains a segment ending with an empty batch, "currOffset" update 
> logic at 
> [https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/coordinator/transaction/TransactionStateManager.scala#L482]
>  will be skipped.  Since "currOffset" is not advanced to next offset of last 
> batch properly, TransactionStateManager.loadTransactionMetadata method will 
> be stuck in the "while" loop at 
> [https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/coordinator/transaction/TransactionStateManager.scala#L438.|https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/coordinator/transaction/TransactionStateManager.scala#L438,]
>  
> After the change of https://issues.apache.org/jira/browse/KAFKA-17076, there 
> is a higher chance for compaction process to generate segments ending with an 
> empty batch. As a result, this issue is more likely to be hit now comparing 
> to before KAFKA-17076 change.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to