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


##########
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:
   This seems like the "Chicken and egg" problem. If we advertised 0 to the 
controller, the controller will always set isCaughtUp=false in 
HeartbeatResponse, the broker will never be ready to begin publishing.
   
   The time sequence currently is: 
   1. LifecycleManager repeatedly sends HeartBeatRequest
   2. The controller set isCaughtUp=true if the advertised offset = high 
watermark
   3. LifecycleManager marks initialCatchUpFuture is completed isCaughtUp=true 
   4. The BrokerServer starts initial publishing after initialCatchUpFuture is 
completed



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