DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
| Table of Contents |
|---|
This page is meant as a template for writing a KIP. To create a KIP choose Tools->Copy on this page and modify with your content and replace the heading with the next KIP number and a description of your issue. Replace anything in italics with your own description.
Status
Current state: Under Discussion
Discussion thread: here [Change the link from the KIP proposal email archive to your own email thread]
JIRA: KAFKA-20029
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
...
This issue is not limited to __transaction_state :
__consumer_offsets: Expansion causes existing consumer groups to lose track of their committed offsets because thegroupIdmapping shifts to a new partition.Partition expansion of __consumer_offsets can cause group IDs to be mapped to different partitions across brokers while metadata is converging. As a result, offset commits, offset fetches, and group coordination operations may fail in a non-deterministic manner depending on which broker handles the request. During this window, it may be impossible to reliably read and write committed offsets, and some groups may become effectively unfindable until the cluster state fully converges__share_group_state: Similar routing logic applies to share groups, risking state inconsistency.
...
Public Interfaces
- Configuration
controller.unstable.allow.internal.coordinator.topicpartition.modificationincrease- Type: boolean
- Default: false
- Description: When set to
true, the controller allows partition expansion for internal topics. This is unsafe.
- Error Codes
INVALID_REQUEST: Returned for specific internal topics within a CreatePartitions response when expansion is attempted without the unsafe config enabled.
- classes
/kafka/core/src/main/scala/kafka/server/ControllerApis.scala → reject request
/kafka/core/src/main/scala/kafka/server/KafkaConfig.scala → Add configuration field for
controller.unstable.allow.internal.coordinator.topicpartition.modificationincreasefor ControllerApi.scala to access./kafka/raft/src/main/java/org/apache/kafka/raft/KRaftConfigs.java → Add
controller.unstable.allow.internal.topiccoordinator.partition.modificationincrease.
Proposed Changes
We propose to enforce a validation check in the Controller API layer to reject CreatePartitions requests targeting internal topics,
while allowing other valid requests in the same batch to proceed.
...
We will introduce a new configuration to control this guardrail.
Config Name:
controller.unstable.allow.internal.topiccoordinator.partition.modificationincreaseDefinition: Defined in
KRaftConfigs.javaand propagated toKafkaConfig.scala.Default:
false
...
The controller will iterate through the list of topics in the
CreatePartitionsRequest.It will identify internal topics using
Topic.isInternal(name).If
controller.unstable.allow.internal.topiccoordinator.partition.modificationincreaseisfalse:Requests for internal topics will be immediately marked with
INVALID_REQUESTerror in the response.Valid (non-internal) topics in the same request will be passed to
controller.createPartitionsfor processing.The final response will merge the results, returning per-topic success or failure codes.
...
- Kafka 4.0 Context: This KIP targets KRaft-only clusters (Zookeeper is deprecated in 4.0).
Behavioral Change (Operational Breaking Change):
This KIP introduces a breaking change in behavior. Previously, expanding internal topics was technically allowed (though unsafe). After this change, such requests will fail with
INVALID_REQUEST.This is a deliberate design choice to prioritize correctness and cluster stability over backward compatibility of an unsafe operation.
- Justification & Mitigation: This change is considered acceptable because Kafka documentation already explicitly advises against modifying internal topics. Furthermore, the impact is mitigated by the opt-in configuration (
controller.unstable.allow.internal.coordinator.topicpartition.modificationincrease). Operators who strictly require this capability can explicitly enable it, ensuring that no critical workflows are permanently blocked.
Client Compatibility:
Existing
AdminClientimplementations (Java, Go, Python, etc.) do not need to be updated. They will simply receive a standardINVALID_REQUESTerror code, which is already handled by standard error handling routines. No binary incompatibility is introduced.
...
No Data Migration Required: This change applies only to metadata operations. Existing data in internal topics is unaffected.
For Administrators:
- If an administrator must expand partitions (e.g., during a critical manual recovery scenario), they must effectively "opt-in" to the risk by dynamically updating the controller configuration
controller.allow.internal.topic.modificationtotrue.Operators who explicitly need to perform this operation may opt in by setting the unsafe controller configuration to true and ensuring it is applied consistently across controllers. Depending on the deployment and configuration management approach, applying this setting may require a controller restart before it takes effect.
- If an administrator must expand partitions (e.g., during a critical manual recovery scenario), they must effectively "opt-in" to the risk by dynamically updating the controller configuration
Test Plan
Unit Tests (
ControllerApisTest):Batch Handling: Verify that a request containing
[valid-topic, __transaction_state]returnsNONE(success) for the valid topic andINVALID_REQUESTfor the internal topic.Config Override: Verify that expansion succeeds when
controller.unstable.allow.internal.topiccoordinator.partition.modificationincreaseistrue.
Integration Tests:
Use
AdminClientagainst a KRaft cluster fixture to verify end-to-end blocking behavior.
...