dengziming commented on code in PR #11951:
URL: https://github.com/apache/kafka/pull/11951#discussion_r856745020


##########
core/src/main/scala/kafka/server/BrokerLifecycleManager.scala:
##########
@@ -333,7 +353,11 @@ class BrokerLifecycleManager(val config: KafkaConfig,
   }
 
   private def sendBrokerHeartbeat(): Unit = {
-    val metadataOffset = _highestMetadataOffsetProvider()
+    val metadataOffset = if (readyToUnfence) {

Review Comment:
   Following our current design in `BrokerServer`, when BrokerServer restarts, 
it will not start publishing metadata until it has caught up with the current 
high watermark, so the published offset will always be zero when starting.
   This is necessary because when starting there may be some outdated metadata. 
for example, we created a topic and deleted it but the BrokerServer only read 
parts of the metadata log, the ReplicaManager will initialize some unnecessary 
replicas if it publishes at this point. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to