chia7712 commented on code in PR #17192:
URL: https://github.com/apache/kafka/pull/17192#discussion_r1759242007
##########
core/src/main/scala/kafka/server/KafkaServer.scala:
##########
@@ -1135,6 +1132,10 @@ class KafkaServer(
* @return The brokerId.
*/
private def getOrGenerateBrokerId(metaPropsEnsemble:
MetaPropertiesEnsemble): Int = {
+ if (config.migrationEnabled && config.brokerIdGenerationEnable) {
Review Comment:
Should we move this check to
https://github.com/apache/kafka/blob/d3936365bf0fc7df86c2632a576081474d923e08/core/src/main/scala/kafka/server/KafkaConfig.scala#L965?
##########
core/src/main/scala/kafka/server/KafkaServer.scala:
##########
@@ -260,9 +260,6 @@ class KafkaServer(
/* generate brokerId */
config._brokerId = getOrGenerateBrokerId(initialMetaPropsEnsemble)
- // Currently, we are migrating from ZooKeeper to KRaft. If
broker.id.generation.enable is set to true,
- // we must ensure that the nodeId synchronizes with the broker.id to
prevent the nodeId from being -1,
- // which would result in a failure during the migration.
config._nodeId = config.brokerId
Review Comment:
The `broker.id` must be defined in migration with this patch, so we don't
need to update `_nodeId`. Could you please make `nodeId` be immutable again? Or
just revert the change of #16540 :smile:
##########
core/src/main/scala/kafka/server/KafkaServer.scala:
##########
@@ -1135,6 +1132,10 @@ class KafkaServer(
* @return The brokerId.
*/
private def getOrGenerateBrokerId(metaPropsEnsemble:
MetaPropertiesEnsemble): Int = {
+ if (config.migrationEnabled && config.brokerIdGenerationEnable) {
Review Comment:
BTW, could you please update docs? We need to add
`broker.id.generation.enable=false` to the example and revise the following
item.
https://github.com/apache/kafka/blob/d3936365bf0fc7df86c2632a576081474d923e08/docs/ops.html#L3969
--
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]