kafka/checkstyle/import-control-server-commo...

147 lines
5.8 KiB
XML
Raw Normal View History

<!DOCTYPE import-control PUBLIC
"-//Puppy Crawl//DTD Import Control 1.1//EN"
"http://www.puppycrawl.com/dtds/import_control_1_1.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<import-control pkg="org.apache.kafka">
<!-- THINK HARD ABOUT THE LAYERING OF THE PROJECT BEFORE CHANGING THIS FILE -->
<!-- common library dependencies -->
<allow pkg="java" />
<allow pkg="javax.management" />
<allow pkg="org.slf4j" />
<allow pkg="org.junit" />
<allow pkg="org.hamcrest" />
<allow pkg="org.mockito" />
<allow pkg="java.security" />
<allow pkg="javax.net.ssl" />
<allow pkg="javax.security" />
<allow pkg="net.jqwik.api" />
<allow pkg="javax.crypto" />
<!-- no one depends on the server -->
<disallow pkg="kafka" />
<!-- anyone can use public classes -->
<allow pkg="org.apache.kafka.common" />
<allow pkg="org.apache.kafka.common.security" />
<allow pkg="org.apache.kafka.common.serialization" />
<allow pkg="org.apache.kafka.common.utils" />
<allow pkg="org.apache.kafka.common.errors" exact-match="true" />
<allow pkg="org.apache.kafka.common.memory" />
KAFKA-17587 Refactor test infrastructure (#18602) This patch reorganizes our test infrastructure into three Gradle modules: ":test-common:test-common-internal-api" is now a minimal dependency which exposes interfaces and annotations only. It has one project dependency on server-common to expose commonly used data classes (MetadataVersion, Feature, etc). Since this pulls in server-common, this module is Java 17+. It cannot be used by ":clients" or other Java 11 modules. ":test-common:test-common-util" includes the auto-quarantined JUnit extension. The @Flaky annotation has been moved here. Since this module has no project dependencies, we can add it to the Java 11 list so that ":clients" and others can utilize the @Flaky annotation ":test-common:test-common-runtime" now includes all of the test infrastructure code (TestKitNodes, etc). This module carries heavy dependencies (core, etc) and so it should not normally be included as a compile-time dependency. In addition to this reorganization, this patch leverages JUnit SPI service discovery so that modules can utilize the integration test framework without depending on ":core". This will allow us to start moving integration tests out of core and into the appropriate sub-module. This is done by adding ":test-common:test-common-runtime" as a testRuntimeOnly dependency rather than as a testImplementation dependency. A trivial example was added to QuorumControllerTest to illustrate this. Reviewers: Ismael Juma <ismael@juma.me.uk>, Chia-Ping Tsai <chia7712@gmail.com>
2025-01-24 22:03:43 +08:00
<allow pkg="org.apache.kafka.common.test.api" />
<!-- persistent collection factories/non-library-specific wrappers -->
<allow pkg="org.apache.kafka.server.immutable" exact-match="true" />
<!-- allow config classes for server package -->
<allow pkg="org.apache.kafka.server.config" />
<subpackage name="queue">
<allow pkg="org.apache.kafka.test" />
</subpackage>
<subpackage name="metadata">
<allow pkg="org.apache.kafka.common.message" />
<allow pkg="org.apache.kafka.server.common" />
<allow pkg="org.apache.kafka.common.protocol" />
</subpackage>
<subpackage name="security">
<allow pkg="org.apache.kafka.clients.admin" />
<allow pkg="org.apache.kafka.common.config" />
<allow pkg="org.apache.kafka.common.config.types" />
<allow pkg="org.apache.kafka.server.util" />
<allow pkg="javax.crypto" />
<allow pkg="javax.crypto.spec" />
</subpackage>
<subpackage name="server">
<allow pkg="org.apache.kafka.common" />
<allow pkg="joptsimple" />
<subpackage name="common">
<allow pkg="org.apache.kafka.server.common" />
<allow pkg="org.apache.kafka.clients" />
</subpackage>
<subpackage name="immutable">
<allow pkg="org.apache.kafka.server.util"/>
<!-- only the factory package can use persistent collection library-specific wrapper implementations -->
<!-- the library-specific wrapper implementation for PCollections -->
<allow pkg="org.apache.kafka.server.immutable.pcollections" />
<subpackage name="pcollections">
<allow pkg="org.pcollections" />
</subpackage>
</subpackage>
<subpackage name="metrics">
<allow pkg="com.yammer.metrics" />
</subpackage>
KAFKA-15060: fix the ApiVersionManager interface This PR expands the scope of ApiVersionManager a bit to include returning the current MetadataVersion and features that are in effect. This is useful in general because that information needs to be returned in an ApiVersionsResponse. It also allows us to fix the ApiVersionManager interface so that all subclasses implement all methods of the interface. Having subclasses that don't implement some methods is dangerous because they could cause exceptions at runtime in unexpected scenarios. On the KRaft controller, we were previously performing a read operation in the QuorumController thread to get the current metadata version and features. With this PR, we now read a volatile variable maintained by a separate MetadataVersionContextPublisher object. This will improve performance and simplify the code. It should not change the guarantees we are providing; in both the old and new scenarios, we need to be robust against version skew scenarios during updates. Add a Features class which just has a 3-tuple of metadata version, features, and feature epoch. Remove MetadataCache.FinalizedFeaturesAndEpoch, since it just duplicates the Features class. (There are some additional feature-related classes that can be consolidated in in a follow-on PR.) Create a java class, EndpointReadyFutures, for managing the futures associated with individual authorizer endpoints. This avoids code duplication between ControllerServer and BrokerServer and makes this code unit-testable. Reviewers: David Arthur <mumrah@gmail.com>, dengziming <dengziming1993@gmail.com>, Luke Chen <showuon@gmail.com>
2023-06-08 04:11:55 +08:00
<subpackage name="network">
<allow pkg="org.apache.kafka.server.authorizer" />
</subpackage>
<subpackage name="purgatory">
<allow pkg="org.apache.kafka.server.metrics" />
<allow pkg="org.apache.kafka.server.util" />
<allow pkg="com.yammer.metrics.core" />
</subpackage>
<subpackage name="share">
<allow pkg="org.apache.kafka.server.share" />
<subpackage name="persister">
<allow pkg="org.apache.kafka.clients" />
<allow pkg="org.apache.kafka.server.util" />
<allow pkg="org.apache.kafka.test" />
</subpackage>
</subpackage>
<subpackage name="util">
<!-- InterBrokerSendThread uses some clients classes that are not part of the public -->
<!-- API but are still relatively common -->
KAFKA-15466: Add KIP-919 support for some admin APIs (#14399) Add support for --bootstrap-controller in the following command-line tools: - kafka-cluster.sh - kafka-configs.sh - kafka-features.sh - kafka-metadata-quorum.sh To implement this, the following AdminClient APIs now support the new bootstrap.controllers configuration: - Admin.alterConfigs - Admin.describeCluster - Admin.describeConfigs - Admin.describeFeatures - Admin.describeMetadataQuorum - Admin.incrementalAlterConfigs - Admin.updateFeatures Command-line tool changes: - Add CommandLineUtils.initializeBootstrapProperties to handle parsing --bootstrap-controller in addition to --bootstrap-server. - Add --bootstrap-controller to ConfigCommand.scala, ClusterTool.java, FeatureCommand.java, and MetadataQuorumCommand.java. KafkaAdminClient changes: - Add the AdminBootstrapAddresses class to handle extracting bootstrap.servers or bootstrap.controllers from the config map for KafkaAdminClient. - In AdminMetadataManager, store the new usingBootstrapControllers boolean. Generalize authException to encompass the concept of fatal exceptions in general. (For example, the fatal exception where we talked to the wrong node type.) Treat MismatchedEndpointTypeException and UnsupportedEndpointTypeException as fatal exceptions. - Extend NodeProvider to include information about whether bootstrap.controllers is supported. - Modify the APIs described above to support bootstrap.controllers. Server-side changes: - Support DescribeConfigsRequest on kcontrollers. - Add KRaftMetadataCache to the kcontroller to simplify implemeting describeConfigs (and probably more APIs in the future). It's mainly a wrapper around MetadataImage, so there is essentially no extra resource consumption. - Split RuntimeLoggerManager out of ConfigAdminManager to handle the incrementalAlterConfigs support for BROKER_LOGGER. This is now supported on kcontrollers as well as brokers. - Fix bug in AuthHelper.computeDescribeClusterResponse that resulted in us always sending back BROKER as the endpoint type, even on the kcontroller. Miscellaneous: - Fix a few places in exceptions and log messages where we wrote "broker" instead of "node". For example, an exception in NodeApiVersions.java, and a log message in NetworkClient.java. - Fix the slf4j log prefix used by KafkaRequestHandler logging so that request handlers on a controller don't look like they're on a broker. - Make the FinalizedVersionRange constructor public for the sake of a junit test. - Add unit and integration tests for the above. Reviewers: David Arthur <mumrah@gmail.com>, Doguscan Namal <namal.doguscan@gmail.com>
2023-09-27 05:43:42 +08:00
<allow class="org.apache.kafka.clients.admin.AdminClientConfig" />
<allow class="org.apache.kafka.clients.ClientRequest" />
<allow class="org.apache.kafka.clients.ClientResponse" />
<allow class="org.apache.kafka.clients.KafkaClient" />
<allow class="org.apache.kafka.clients.RequestCompletionHandler" />
KAFKA-15466: Add KIP-919 support for some admin APIs (#14399) Add support for --bootstrap-controller in the following command-line tools: - kafka-cluster.sh - kafka-configs.sh - kafka-features.sh - kafka-metadata-quorum.sh To implement this, the following AdminClient APIs now support the new bootstrap.controllers configuration: - Admin.alterConfigs - Admin.describeCluster - Admin.describeConfigs - Admin.describeFeatures - Admin.describeMetadataQuorum - Admin.incrementalAlterConfigs - Admin.updateFeatures Command-line tool changes: - Add CommandLineUtils.initializeBootstrapProperties to handle parsing --bootstrap-controller in addition to --bootstrap-server. - Add --bootstrap-controller to ConfigCommand.scala, ClusterTool.java, FeatureCommand.java, and MetadataQuorumCommand.java. KafkaAdminClient changes: - Add the AdminBootstrapAddresses class to handle extracting bootstrap.servers or bootstrap.controllers from the config map for KafkaAdminClient. - In AdminMetadataManager, store the new usingBootstrapControllers boolean. Generalize authException to encompass the concept of fatal exceptions in general. (For example, the fatal exception where we talked to the wrong node type.) Treat MismatchedEndpointTypeException and UnsupportedEndpointTypeException as fatal exceptions. - Extend NodeProvider to include information about whether bootstrap.controllers is supported. - Modify the APIs described above to support bootstrap.controllers. Server-side changes: - Support DescribeConfigsRequest on kcontrollers. - Add KRaftMetadataCache to the kcontroller to simplify implemeting describeConfigs (and probably more APIs in the future). It's mainly a wrapper around MetadataImage, so there is essentially no extra resource consumption. - Split RuntimeLoggerManager out of ConfigAdminManager to handle the incrementalAlterConfigs support for BROKER_LOGGER. This is now supported on kcontrollers as well as brokers. - Fix bug in AuthHelper.computeDescribeClusterResponse that resulted in us always sending back BROKER as the endpoint type, even on the kcontroller. Miscellaneous: - Fix a few places in exceptions and log messages where we wrote "broker" instead of "node". For example, an exception in NodeApiVersions.java, and a log message in NetworkClient.java. - Fix the slf4j log prefix used by KafkaRequestHandler logging so that request handlers on a controller don't look like they're on a broker. - Make the FinalizedVersionRange constructor public for the sake of a junit test. - Add unit and integration tests for the above. Reviewers: David Arthur <mumrah@gmail.com>, Doguscan Namal <namal.doguscan@gmail.com>
2023-09-27 05:43:42 +08:00
<allow class="org.apache.kafka.clients.CommonClientConfigs" />
<allow pkg="com.fasterxml.jackson" />
<allow pkg="org.apache.kafka.server.util.json" />
<allow class="org.apache.kafka.server.util.TopicFilter.IncludeList" />
<allow class="org.apache.kafka.test.TestUtils" />
<subpackage name="timer">
<allow class="org.apache.kafka.server.util.MockTime" />
<allow class="org.apache.kafka.server.util.ShutdownableThread" />
</subpackage>
</subpackage>
<subpackage name="config">
<allow pkg="org.apache.kafka.server"/>
<allow pkg="org.apache.kafka.clients"/>
</subpackage>
</subpackage>
<subpackage name="admin">
<allow pkg="org.apache.kafka.server.common" />
</subpackage>
</import-control>