jolshan commented on code in PR #13608: URL: https://github.com/apache/kafka/pull/13608#discussion_r1187719600
########## core/src/main/scala/kafka/log/UnifiedLog.scala: ########## @@ -579,9 +579,33 @@ class UnifiedLog(@volatile var logStartOffset: Long, result } - def hasOngoingTransaction(producerId: Long): Boolean = lock synchronized { - val entry = producerStateManager.activeProducers.get(producerId) - entry != null && entry.currentTxnFirstOffset.isPresent + def transactionNeedsVerifying(producerId: Long, producerEpoch: Short, baseSequence: Int): Boolean = lock synchronized { + val entry = producerStateManager.entryForVerification(producerId, producerEpoch, baseSequence) + (!entry.currentTxnFirstOffset.isPresent) && + (entry.compareAndSetVerificationState(producerEpoch, ProducerStateEntry.VerificationState.EMPTY, ProducerStateEntry.VerificationState.VERIFYING) || + entry.verificationState() == ProducerStateEntry.VerificationState.VERIFYING) + } + + def compareAndSetVerificationState(producerId: Long, + producerEpoch: Short, + baseSequence: Int, + expectedVerificationState: ProducerStateEntry.VerificationState, + newVerificationState: ProducerStateEntry.VerificationState): Unit = { lock synchronized { Review Comment: That's the method braces. Should I just make a new line so it is clearer? -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org