chia7712 commented on PR #16491:
URL: https://github.com/apache/kafka/pull/16491#issuecomment-2204040094

   > Thus, I don't think it will cause the error as described in the JIRA, 
right? I still don't understand in what circumstance this issue will happen. It 
might need more explanation. Thanks.
   
   thanks for this response, and it inspires me to dig-in the root cause. The 
issue happens when the zk broker is using generated broker id and it is in 
migrating.
   
   1. if we define the broker id in config file, the broker id is viewed as 
invalid since it is in the reserved range (when 
`broker.id.generation.enable=true`)
   2. if we don't define the broker id in config file, the broker id will be 
evaluated according to `meta.properties` [0] . However, we forgot to update 
`node.id` and so kraft client will use "node.id=-1" [1] to build and it results 
in error ..
   
   
   [0] 
https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/server/KafkaServer.scala#L261
   [1] 
https://github.com/apache/kafka/blob/e55c28c60b0f021b12c93fa04e360ce7a2e0a5ac/core/src/main/scala/kafka/raft/RaftManager.scala#L230
   
   In short, we don't consider the use case of "generated broker id (the broker 
id is omitted)" + "zk migration". It seems we need two fixes:
   
   1. update docs to explain the possible error when you define the broker id 
for the zk broker which is using `broker.id.generation.enable`
   2. in order to minimize the changes, we can update both `broker.id` and 
`node.id` together. The side effect is `KafkaConfig#nodeId` will be a mutable 
variable.
   
   @showuon WDYT?


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