You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/12/21 19:34:48 UTC
[GitHub] [kafka] cmccabe commented on a diff in pull request #13033: KAFKA-14538: Implement KRaft metadata transactions
cmccabe commented on code in PR #13033:
URL: https://github.com/apache/kafka/pull/13033#discussion_r1054775292
##########
core/src/main/scala/kafka/server/metadata/BrokerMetadataListener.scala:
##########
@@ -289,6 +316,59 @@ class BrokerMetadataListener(
BatchLoadResults(numBatches, numRecords, NANOSECONDS.toMicros(elapsedNs), numBytes)
}
+ private def applyRecordToDelta(
+ delta: MetadataDelta,
+ messageAndVersion: ApiMessageAndVersion,
+ baseOffset: Long,
+ index: Int,
+ snapshotName: Option[String]
+ ): Unit = {
+ try {
+ delta.replay(messageAndVersion.message())
+ } catch {
+ case e: Throwable => snapshotName match {
+ case None => metadataLoadingFaultHandler.handleFault(
+ s"Error replaying metadata log record at offset ${baseOffset + index}", e)
+ case Some(name) => metadataLoadingFaultHandler.handleFault(
+ s"Error replaying record ${index} from snapshot ${name} at offset ${_highestOffset}", e)
+ }
+ }
+ }
+
+ private def beginTransaction(newTransactionEpoch: Int, newTransactionOffset: Long): Unit = {
+ if (_transactionEpoch != -1) {
+ abortTransaction("a new begin transaction record appeared", newTransactionOffset)
+ }
+ _transactionEpoch = newTransactionEpoch
+ _transactionOffset = newTransactionOffset
+ _transactionRecords = new util.ArrayList[ApiMessageAndVersion]
+ log.debug("Beginning metadata transaction {}_{}.", _transactionOffset, _transactionEpoch)
+ }
+
+ private def endTransaction(delta: MetadataDelta, endOffset: Long): Unit = {
+ log.debug("Ending metadata transaction {}_{} at offset {}", _transactionOffset, _transactionEpoch, endOffset)
+ var index = 0
+ _transactionRecords.forEach(record => {
Review Comment:
yes, I will check if there is a transaction and raise a fault if so.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org