Versions Compared

Key

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

Table of Contents

Status

Current state:  Discuss Accepted

Discussion thread: here

JIRA:   KAFKA-2204

Motivation

In Kafka, there is no general mechanism to change entity configuration without doing a rolling restart of the entire cluster. Currently, only topic configs can be changed dynamically. This proposal attempts to build a unified mechanism for modeling configuration across various entities within Kafka i.e. topics, clients etc.

...

ZNode Structure

Code Block
There will be 23 paths within config
/config/clients/<client_id>
/config/topics/<topic_name>
/config/changes/

Internally, the znodes are comma-separated key-value pairs where key represents the configuration property to change.
{"version": x, "config" : {X1 : Y1, X2 : Y2..}}

...

Code Block
{"version" : 1, "config" : {"producer-_byte-_rate" : 1000, "consumer-_byte-_rate" : 2000}}

Config Change Notification

...

Code Block
The notification data can be:
{"version" : 1, "entity_type":"topic/client", "valueentity_name" : "topic_name/client_id"}

...

Code Block
// EntityType can be either topic or client. AddedConfigEntry and DeletedConfig will be an array.
AlterConfigRequest => [EntityType EntityName [AddedConfigEntry] [DeletedConfig]]
    EntityType => string
    EntityName => string
    AddedConfigEntry => [ConfigKey ConfigValue]
        ConfigKey => string
        ConfigValue => string
    DeletedConfig => string
 
AlterConfigResponse => [EntityType EntityName ErrorCode]
	EntityType => string
  	EntityName => string
	ErrorCode => int16

...

Code Block
DescribeConfigRequest => [EntityType EntityName]
    EntityType => string
	EntityName => string
 
// ConfigEntry is an array. It will be empty if there is an error. ErrorCode will be non-zero in case of error
DescribeConfigResponse => [EntityType EntityName ConfigEntry]
    EntityType => string
    EntityName => string
	ErrorCode => int16
    ConfigEntry => [ConfigKey ConfigValue]
        ConfigKey => string
        ConfigValue => string

Error Codes

We will add these new error codes to the protocol.

Error

Description

Requests
InvalidEntityConfigIf the config key or value used in --alter-config and --delete-config is incorrect, InvalidConfig is returnedAlter
InvalidEntity Either the entityType or entityName is incorrect. Entity Type must be (topics/clients)Alter, Describe

CLI and Interactive Shell

...

Code Block
# Topic Commands - options are ported from TopicCommand.scala
bin/kafka.sh --alter-config --entityTypeentity-type [topic/client] --entityNameentity-name name --added-config key=value,key=value --deleted-config key,key,key --broker-list <host : port>
bin/kafka.sh --describe-config --entityTypeentity-type [topic/client] --entity-entityNamename name --broker-list <host : port>

...

  • TopicConfigManager has a config_change_XX sequential znode under configs/. The format of data within the config_change node is going to change hence it is important to not make any config changes using TopicCommand until the cluster is fully upgraded
  • We will eventually deprecate the tooling that changes entity configs by modifying znodes directly. All requests should be sent to one of the brokers after KIP-4 is complete.

Migration plan for notifications

Since the format of notifications is going to change, the new code will no longer be able to read topic change notifications written in the older format. The purge interval for notifications is 15 minutes, so any notification older than 15 minutes should be ignored regardless of the content in the znode. In order to not lose any notifications, cluster administrators should not allow any config changes for at least 15 minutes prior to upgrading the cluster. Upon startup, the brokers will parse all notifications and purge the old ones
After the upgrade is complete, config changes cannot be done using tooling from older releases of Kafka.

If a rollback must be done after config changes have been made using the new format, the config changes must be purged from zookeeper prior to the rollback (since the old code will throw an exception if it reads a notification in the new format).

Rejected Alternatives

Dynamic Service Configs: After plenty of discussion, we've decided to not allow broker(service) configuration be dynamic. There were a couple of approaches:

...