DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
| Table of Contents |
|---|
Status
Current state: "Under DiscussionCanceled"
Discussion thread: here
https://lists.apache.org/thread/9l6m1scv765ohbwjkwq5sotjcdjzjp4q
Vote thread: https://lists.apache.org/thread/mlzvnnfx9jwv0v0lql1hocno4xxk7cr8
JIRA: JIRA:
| Jira | |||||
|---|---|---|---|---|---|
|
|
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
@Deprecated/** public interface* ClientQuotaCallback@deprecated, extendsplease use {@link ClientQuotaCallbackHandler} instead */ @Deprecated public interface ClientQuotaCallback extends ClientQuotaCallbackHandler { /** * This callback is invoked whenever there are changes in the cluster metadata, such as * brokers being added or removed, topics being created or deleted, or partition leadership updates. * This is useful if quota computation takes partitions into account. * Topics that are being deleted will not be included in `cluster`. * * @deprecated please use {@link ClientQuotaCallbackHandler#updateClusterMetadata(ClusterMetadata)} instead * @param cluster Cluster metadata including partitions and their leaders if known * @return true if quotas have changed and metric configs may need to be updated */ @Deprecated boolean updateClusterMetadata(Cluster cluster); default boolean updateClusterMetadata(ClusterMetadata clusterMetadata) { return updateClusterMetadata(toCluster(clusterMetadata)); } } |
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
public interface ClusterMetadata {
/**
* Get a list of Kafka broker node IDs in the cluster.
*/
List<Integer> brokerIds();
/**
* Get specific broker information.
*/
Optional<BrokerMetadata> broker(int nodeId);
/**
* Get specific partition information.
*/
PartitionMetadataOptional<PartitionMetadata> partition(TopicPartition topicPartition);
/**
* Get partition information of specific topic.
* The key is the partition id, and the value is the metadata
* associated with that partition.
* Return an empty map if topic does not exist.
*/
Map<Integer, PartitionMetadata> partitionsForTopicpartitions(String topic);
/**
* Get partition information of specific topic and specific node.
* The key is the TopicPartitionpartition id, and the value is the metadata
* associated with that partition.
* associated with that partition * Return an empty map if the topic or node id does not exist.
*/
Map<TopicPartitionMap<Integer, PartitionMetadata> partitionsForNodepartitions(String topic, int nodeId);
/**
* Get a map of topics.
* The key is the topic id, and the value is the topic name.
*/
Map<Uuid, String> topics();
/**
* Get ClusterResource that includes cluster id
*/
ClusterResource clusterResource();
/**
* Given a partition metadata, return the subset of the replicas that are offline.
* Return an empty list if there is no offline replicas.
*/
List<Integer> offlineReplicas(PartitionMetadata partitionMetadata);
} |
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
public interface BrokerMetadata {
/**
* The broker node id
*/
int id();
/**
* The listeners of the broker node.
*/
Map<String, Endpoint> listeners();
/**
* Whether if this node is fenced
*/
boolean fenced();
/**
* The rack for this node
*/
Optional<String> rack();
} |
...
For example, the implementation of ClusterMetadata#partitionsForTopicClusterMetadata#partitions(String) simply wraps the map returned by TopicImage.partitions().
...
Add the new method
updateClusterMetadata(ClusterMetadata)to the old interfaceClientQuotaCallback, while doing this have a downside is that once we remove that deprecated function, it will break compilation for anyone who already implementing it.Code Block language java public interface ClientQuotaCallback extends Configurable { // ...skip ...// @Deprecated(since = "4.1", forRemoval = true) boolean updateClusterMetadata(Cluster cluster); default boolean updateClusterMetadata(ClusterMetadata clusterMetadata) { return updateClusterMetadata(toCluster(clusterMetadata)); } }
...