cmccabe commented on code in PR #12596:
URL: https://github.com/apache/kafka/pull/12596#discussion_r965319916


##########
core/src/main/scala/kafka/server/metadata/BrokerMetadataListener.scala:
##########
@@ -322,16 +322,22 @@ class BrokerMetadataListener(
 
   private def publish(publisher: MetadataPublisher): Unit = {
     val delta = _delta
-    _image = _delta.apply()
-    _delta = new MetadataDelta(_image)
-    if (isDebugEnabled) {
-      debug(s"Publishing new metadata delta $delta at offset 
${_image.highestOffsetAndEpoch().offset}.")
-    }
-    publisher.publish(delta, _image)
+    try {
+      _image = _delta.apply()
+      _delta = new MetadataDelta(_image)
+      if (isDebugEnabled) {
+        debug(s"Publishing new metadata delta $delta at offset 
${_image.highestOffsetAndEpoch().offset}.")
+      }
 
-    // Update the metrics since the publisher handled the lastest image
-    brokerMetrics.lastAppliedRecordOffset.set(_highestOffset)
-    brokerMetrics.lastAppliedRecordTimestamp.set(_highestTimestamp)
+      // This publish call is done with its own try-catch and fault handler
+      publisher.publish(delta, _image)
+
+      // Update the metrics since the publisher handled the lastest image
+      brokerMetrics.lastAppliedRecordOffset.set(_highestOffset)
+      brokerMetrics.lastAppliedRecordTimestamp.set(_highestTimestamp)
+    } catch {

Review Comment:
   can you please scope this to just delta.apply? We already have other 
exceptions thrown here and we don't want to double count faults.



-- 
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

Reply via email to