forked from apache/kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KAFKA-14351: Controller Mutation Quota for KRaft (apache#13116)
Implement KIP-599 controller mutation quotas for the KRaft controller. These quotas apply to create topics, create partitions, and delete topic operations. They are specified in terms of number of partitions. The approach taken here is to reuse the ControllerMutationQuotaManager that is also used in ZK mode. The quotas are implemented as Sensor objects and Sensor.checkQuotas enforces the quota, whereas Sensor.record notes that new partitions have been modified. While ControllerApis handles fetching the Sensor objects, we must make the final callback to check the quotas from within QuorumController. The reason is because only QuorumController knows the final number of partitions that must be modified. (As one example, up-to-date information about the number of partitions that will be deleted when a topic is deleted is really only available in QuorumController.) For quota enforcement, the logic is already in place. The KRaft controller is expected to set the throttle time in the response that is embedded in EnvelopeResponse, but it does not actually apply the throttle because there is no client connection to throttle. Instead, the broker that forwarded the request is expected to return the throttle value from the controller and to throttle the client connection. It also applies its own request quota, so the enforced/returned quota is the maximum of the two. This PR also installs a DynamicConfigPublisher in ControllerServer. This allows dynamic configurations to be published on the controller. Previously, they could be set, but they were not applied. Note that we still don't have a good way to set node-level configurations for isolatied controllers. However, this will allow us to set cluster configs (aka default node configs) and have them take effect on the controllers. In a similar vein, this PR separates out the dynamic client quota publisher logic used on the broker into DynamicClientQuotaPublisher. We can now install this on both BrokerServer and ControllerServer. This makes dynamically configuring quotas (such as controller mutation quotas) possible. Also add a ducktape test, controller_mutation_quota_test.py. Reviewers: David Jacot <[email protected]>, Ismael Juma <[email protected]>, Colin P. McCabe <[email protected]>
- Loading branch information
1 parent
29a1a16
commit e3817ca
Showing
15 changed files
with
1,040 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.