DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
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: [One of "Under Discussion", "Accepted", "Rejected"]
...
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Motivation
Today, Apache Kafka lacks a mechanism to enforce configuration constraints that are tied to specific metadata versions. This creates two problems:
...
Additionally, the controller currently has no visibility into broker static configurations (those set in server.properties). Since these configs need to be changed dynamically, they must be validated before an upgrade is allowed — otherwise, a broker whose static config violates a new constraint would fail after the upgrade.
Proposed Changes
This KIP introduces three interconnected features:
- Broker static reporting: Brokers report their static (non-sensitive) configurations to the controller during registration. This enables the controller to perform pre-flight validation of static configs during metadata version upgrades.
- Metadata-Version-Aware Validators::Configuration definitions can now specify validators that apply at specific metadata version feature levels. The ConfigDef.define() method accepts a mvValidators parameter — a map from feature level (short) to ConfigDef.Validator instances.
- When a broker register to cluster, if it has illegal config, the controller should reject its join.
- When alterConfig and incrementalAlterConfig, metadata-version validator should be called to check new config is satisfy to metadata version requirements.
- When admin.upgrade and downgrade, all configurations (static config and dynamic config) should be validated it is satisfy to metadata version requirements.
Public Interfaces
ConfigDef
We add new field mvValidator to make configuration can be validated according to metadata version.
| Code Block | ||||
|---|---|---|---|---|
| ||||
public static class ConfigKey {
public final String name;
public final Type type;
public final String documentation;
public final Object defaultValue;
public final Validator validator;
public final Importance importance;
public final String group;
public final int orderInGroup;
public final Width width;
public final String displayName;
public final List<String> dependents;
public final Recommender recommender;
public final boolean internalConfig;
public final String alternativeString;
public final NavigableMap<Short, Validator> mvValidators; // new field
...
} |
BrokerRegistrationRequest
Bump BrokerRegistrationRequest and BrokerRegistrationResponse to add static configuration fields.
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
diff --git a/metadata/src/main/resources/common/metadata/RegisterBrokerRecord.json b/metadata/src/main/resources/common/metadata/RegisterBrokerRecord.json
index b7db680cbd..5570cbd96f 100644
--- a/metadata/src/main/resources/common/metadata/RegisterBrokerRecord.json
+++ b/metadata/src/main/resources/common/metadata/RegisterBrokerRecord.json
@@ -17,11 +17,12 @@
// Version 2 adds IsMigratingZkBroker
// Version 3 adds LogDirs
// Version 4 adds CordonedLogDirs
+// Version 5 adds StaticConfigs for broker static config reporting.
{
"apiKey": 0,
"type": "metadata",
"name": "RegisterBrokerRecord",
- "validVersions": "0-4",
+ "validVersions": "0-5",
"flexibleVersions": "0+",
"fields": [
{ "name": "BrokerId", "type": "int32", "versions": "0+", "entityType": "brokerId",
@@ -61,6 +62,16 @@
{ "name": "LogDirs", "type": "[]uuid", "versions": "3+", "taggedVersions": "3+", "tag": 0,
"about": "Log directories configured in this broker which are available." },
{ "name": "CordonedLogDirs", "type": "[]uuid", "versions": "4+", "taggedVersions": "4+", "tag": "1",
- "about": "Log directories that are cordoned." }
+ "about": "Log directories that are cordoned." },
+ { "name": "StaticConfigs", "type": "[]BrokerStaticConfig", "versions": "5+",
+ "taggedVersions": "5+", "tag": 2,
+ "about": "Non-default static configs reported by the broker.", "fields": [
+ { "name": "Name", "type": "string", "versions": "5+",
+ "about": "The config name." },
+ { "name": "Value", "type": "string", "versions": "5+", "nullableVersions": "5+",
+ "about": "The config value. Null if the config is sensitive." },
+ { "name": "IsSensitive", "type": "bool", "versions": "5+", "default": "false",
+ "about": "True if this configuration is sensitive." }
+ ]}
]
} |
Compatibility, Deprecation, and Migration Plan
- Add unit test and integration test to cover new feature.
- When admin upgrade or downgrade to specific metadata version, if there is any illegal config, it will return InvalidConfigError
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
If there are alternative ways of accomplishing the same thing, what were they? The purpose of this section is to motivate why the design is the way it is and not some other way.