THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
We shall introduce couple new APIs in the Admin interface, which enables us to read/finalize the feature version upgrades. Here Below is Java-ish pseudocode for the same:.
Admin API changes
Code Block | ||
---|---|---|
| ||
// ---- START: Proposed Admin API definitions ----
/**
* Update the feature versions supported cluster-wide. You may
* anticipate certain exceptions when calling get() on the futures
* obtained from the returned UpdateFeaturesResult.
*
* @param updates set of feature updates, keyed by the
* name of the feature
* @return the result of the updateFeatures request
*/
UpdateFeaturesResult updateFeatures(Set<FeatureUpdate> updates);
/**
* List the feature versions supported cluster-wide (via ApiVersions API).
*/
DescribeFeaturesResult describeFeatures();
// ---- END: Proposed Admin API definitions ----
interface Feature {
// The name of the feature to be updated.
String getName();
// The new value of the feature version.
Long getVersion();
}
enum FeatureUpdateType {
// Delete the feature. Useful to eliminate accidental junk,
// or rarely eliminate a deprecated feature altogether.
DELETE,
// Either add the feature (if not present), or update it (if present).
ADD_OR_UPDATE
}
interface FeatureUpdate {
// Return the feature to be updated.
Feature getFeature();
// Return the type of update to be made.
FeatureUpdateType getUpdateType();
}
interface FinalizedFeatureMetadata {
// The set of cluster-wide finalized features.
Set<Feature> features;
// The monotonically increasing metadata version.
Long getMetadataVersion();
}
interface UpdateFeaturesResult {
/**
* Returns a future which indicates success/failure.
* 1. If the future has succeeded (i.e. no exceptions),
* then the request was 100% successful, and no top level or
* individual FeatureUpdate errors were seen. The data
* returned in the future contains the latest entire set of
* finalized cluster-wide features (after all updates were applied).
* 2. If the future has failed, the top level error (if any)
* or the error from the first failed FeatureUpdate
* (if any) is raised to the caller.
*/
KafkaFuture<FinalizedFeatureMetadata> all();
}
interface DescribeFeaturesResult {
/**
* The data returned in the future contains the latest entire set of
* finalized cluster-wide features.
*/
KafkaFuture<FinalizedFeatureMetadata> all();
} |
Tooling support examples
Following are examples of the tool, the type of options supported, and the output.
Code Block |
---|
=== DESCRIBE FEATURES ===
# Describe features supported cluster-wide.
# - Optionally, provide a broker host:port to which the `ApiVersions` query should be issued.
# - Optionally, provide --controller flag directing the tool to issue the query to the controller.
$> kafka-features.sh describe [--bootstrap-server kafka-broker0.prn1:9071] [--controller]
{
"status": "OK",
"supported_features": {
"group_coordinator": {
"minVersion": 1,
"maxVersion": 2
},
"transaction_coordinator": {
"minVersion": 0,
"maxVersion": 5
},
"consumer_offsets_topic_schema": {
"minVersion": 3,
"maxVersion": 7
}
},
"finalized_features": {
"group_coordinator": {
"version": 1
},
"transaction_coordinator": {
"version": 4
},
"consumer_offsets_topic_schema": {
"version": 7
}
},
"host": "kafka-broker0.prn1",
"port": 9071
}
=== UPDATE FEATURES ===
# Update a list of cluster-wide finalized features.
# - Provide the type of update, ex: ADD_OR_UPDATE, DELETE.
# - Provide a comma-separated list of features and their new finalized versions to update.
$> kafka-features.sh update --update-type ADD_OR_UPDATE --features group_coordinator:2,transaction_coordinator:5
Please confirm finalizing the upgrade of the following features:
1. group_coordinator from v1 (existing) to v2 (new)
2. transaction_coordinator from v4 (existing) to v5 (new)?
[Y/n]? Y
{
"status": "OK",
"supported_features": {
"group_coordinator": {
"minVersion": 1,
"maxVersion": 2
},
"transaction_coordinator": {
"minVersion": 0,
"maxVersion": 5
},
"consumer_offsets_topic_schema": {
"minVersion": 3,
"maxVersion": 7
}
},
"finalized_features": {
"group_coordinator": {
"version": 2
},
"transaction_coordinator": {
"version": 5
},
"consumer_offsets_topic_schema": {
"version": 7
}
},
"host": "kafka-broker0.prn1",
"port": 9071
}
=== DELETE FEATURES ===
# Delete a list of cluster-wide finalized features.
# - Provide the type of update, ex: DELETE.
# - Provide a comma-separated list of features to be deleted.
$> kafka-features.sh update --update-type DELETE --features group_coordinator,transaction_coordinator
Please confirm deletion of features:
1. group_coordinator
2. transaction_coordinator
[Y/n] Y
{
"status": "OK",
"supported_features": {
"group_coordinator": {
"minVersion": 1,
"maxVersion": 2
},
"transaction_coordinator": {
"minVersion": 0,
"maxVersion": 5
},
"consumer_offsets_topic_schema": {
"minVersion": 3,
"maxVersion": 7
}
},
"finalized_features": {
"consumer_offsets_topic_schema": {
"version": 7
}
},
"host": "kafka-broker0.prn1",
"port": 9071
} |
Use case: group_coordinator
feature flag (for KIP-447)
...