jolshan commented on code in PR #13787: URL: https://github.com/apache/kafka/pull/13787#discussion_r1221909838
########## core/src/main/scala/kafka/log/UnifiedLog.scala: ########## @@ -579,6 +579,28 @@ class UnifiedLog(@volatile var logStartOffset: Long, result } + /** + * Maybe create and return the verification guard object for the given producer ID if the transaction is not yet ongoing. + * Creation starts the verification process. Otherwise return null. + */ + def maybeStartTransactionVerification(producerId: Long): Object = lock synchronized { + if (hasOngoingTransaction(producerId)) + null + else + verificationGuard(producerId, true) + } + + /** + * Maybe create the VerificationStateEntry for the given producer ID -- if an entry is present, return its verification guard, otherwise, return null. + */ + def verificationGuard(producerId: Long, createIfAbsent: Boolean = false): Object = lock synchronized { Review Comment: This is also used in unifiedLog when we create the object and when we do the final check. But I can make it package private. -- 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