Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Status

Current state: DraftUnder Discussion

Discussion thread: Nonehere

JIRA:

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyKAFKA-18628

...

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

Describe the problems you are trying to solve.

Public Interfaces

Briefly list any new interfaces that will be introduced as part of this proposal or any existing interfaces that will be removed or changed. The purpose of this section is to concisely call out the public contract that will come along with this feature.

A public interface is any change to the following:

  • Binary log format

  • The network protocol and api behavior

  • Any class in the public packages under clientsConfiguration, especially client configuration

    • org/apache/kafka/common/serialization

    • org/apache/kafka/common

    • org/apache/kafka/common/errors

    • org/apache/kafka/clients/producer

    • org/apache/kafka/clients/consumer (eventually, once stable)

  • Monitoring

  • Command line tools and arguments

  • Anything else that will likely break existing users in some way when they upgrade

Proposed Changes

Describe the new thing you want to do in appropriate detail. This may be fairly extensive and have large subsections of its own. Or it may be a few sentences. Use judgement based on the scope of the change.

Compatibility, Deprecation, and Migration Plan

  • What impact (if any) will there be on existing users?
  • If we are changing behavior how will we phase out the older behavior?
  • If we need special migration tools, describe them here.
  • When will we remove the existing behavior?

Test Plan

Describe in few sentences how the KIP will be tested. We are mostly interested in system tests (since unit-tests are specific to implementation details). How will we know that the implementation works as expected? How will we know nothing broke?

Rejected Alternatives

...

h1. Motivation

Since Apache Kafka 4.0, ZooKeeper has been removed and KRaft is the only supported mode ([KIP-500|https://cwiki.apache.org/confluence/display/KAFKA/KIP-500%3A+Replace+ZooKeeper+with+a+Self-Managed+Metadata+Quorum]). In KRaft mode, a single process can serve as a broker, a controller, or both. [KIP-631|https://cwiki.apache.org/confluence/display/KAFKA/KIP-631%3A+The+Quorum-based+Kafka+Controller] therefore introduced {{node.id}} to replace {{broker.id}} as the canonical node identifier.

However, the legacy {{broker.id}} configuration still exists and is treated as a synonym of {{node.id}}. If only one is set, the other is automatically populated with the same value. If both are explicitly set, they must be equal; otherwise, a {{ConfigException}} is thrown.

Having two configuration properties that must always hold the same value causes unnecessary confusion. The documentation describes {{node.id}} as required in KRaft mode, yet the synonym mechanism allows users to omit {{node.id}} entirely if {{broker.id}} is set, contradicting the documented requirement.

Related ZooKeeper-era configurations such as {{broker.id.generation.enable}} and {{reserved.broker.max.id}} were already removed in Kafka 4.0, making {{broker.id}} the only remaining legacy identifier config. We should deprecate it to simplify the configuration surface and guide all users toward the single, canonical configuration: {{node.id}}.

h1. Public Interfaces

This KIP proposes to deprecate the {{broker.id}} server configuration property in Apache Kafka 4.3 and remove it in Apache Kafka 5.0.

||Config||Type||Default||4.3||5.0||
|{{broker.id}}|INT|\-1|*Deprecated*|*Removed*|
|{{node.id}}|INT|_(required)_|No change|No change|

Note: The documentation describes {{node.id}} as required in KRaft mode, but it can currently be omitted if {{broker.id}} is set, because the synonym mechanism automatically populates {{node.id}} from {{broker.id}}. After the removal in 5.0, {{node.id}} must be explicitly set.

No changes to public APIs, network protocols, metrics, or command-line tools.

h1. Proposed Changes

h2. Phase 1: Deprecation (Apache Kafka 4.3)

# *Log deprecation warning*: When {{broker.id}} is explicitly set in the server configuration, log a WARN-level message at startup:
{code}
The 'broker.id' configuration is deprecated and will be removed in Apache Kafka 5.0. Please use 'node.id' instead.
{code}
# *Preserve backward compatibility*: The existing synonym mechanism will continue to function. Users who only set {{broker.id}} will still have it automatically copied to {{node.id}}. The validation requiring both to be equal (if both are explicitly set) also remains unchanged.

h2. Phase 2: Removal (Apache Kafka 5.0)

# *Remove {{broker.id}} configuration*: The {{BROKER_ID_CONFIG}} will be removed from {{ServerConfigs}}. Setting it will result in an unknown configuration warning.
# *Remove synonym logic*: Remove the {{broker.id}}/{{node.id}} synonym handling from {{AbstractKafkaConfig.populateSynonyms()}}.
# *Retain internal {{brokerId()}} accessor*: The {{brokerId()}} method will continue to exist for internal use, delegating to {{nodeId()}}.

h2. Behavior Matrix

The following table summarizes the expected behavior for each configuration scenario across version ranges:

||Configuration||4.0 ~ 4.2 (Current)||4.3 ~ 4.x (Deprecated)||5.0 (Removed)||
|Only {{node.id}} set|Valid|Valid|Valid|
|Only {{broker.id}} set|Valid; {{node.id}} is auto-populated from {{broker.id}}|Valid + *deprecation warning*; {{node.id}} is auto-populated from {{broker.id}}|{{ConfigException}}: {{node.id}} is required|
|Both set, same value|Valid|Valid + *deprecation warning*|Valid; {{broker.id}} is ignored with *unknown config warning*|
|Both set, different values|*Error*: {{node.id}} must equal {{broker.id}}|*Error*: {{node.id}} must equal {{broker.id}}|Valid; {{broker.id}} is ignored with *unknown config warning*|
|Neither set|{{ConfigException}}: {{node.id}} is required|*Error*: {{node.id}} is required|{{ConfigException}}: {{node.id}} is required|

h1. Compatibility, Deprecation, and Migration Plan

h2. Migration Steps

Users should replace {{broker.id}} with {{node.id}} in their server configuration. If both are configured, simply remove {{broker.id}}.

h1. Test Plan

h2. Phase 1: Deprecation (Apache Kafka 4.3)

Unit tests to verify:
* A deprecation warning is logged when {{broker.id}} is explicitly set (with or without {{node.id}}).
* Backward compatibility: setting only {{broker.id}} still works (existing tests in {{KafkaConfigTest}} already create configs with only {{broker.id}} set).

h2. Phase 2: Removal (Apache Kafka 5.0)

Unit tests to verify:
* {{broker.id}} is no longer recognized and is ignored with an unknown config warning.
* Setting only {{broker.id}} without {{node.id}} results in a {{ConfigException}}.

h1. Rejected Alternatives

_None._