Skip to content

MINOR-restructuring: Relocated PartitionMetadataClient to server-common#21440

Merged
apoorvmittal10 merged 4 commits intoapache:trunkfrom
chirag-wadhwa5:MINOR-restructuring
Feb 12, 2026
Merged

MINOR-restructuring: Relocated PartitionMetadataClient to server-common#21440
apoorvmittal10 merged 4 commits intoapache:trunkfrom
chirag-wadhwa5:MINOR-restructuring

Conversation

@chirag-wadhwa5
Copy link
Collaborator

@chirag-wadhwa5 chirag-wadhwa5 commented Feb 10, 2026

This PR moves PartitionMetadataClient to server-common so it can be
reused across multiple components. The change improves modularity,
avoids duplication, and makes these clients accessible from all required
call sites without tight coupling.

@github-actions github-actions bot added triage PRs from the community core Kafka Broker group-coordinator labels Feb 10, 2026
@@ -54,7 +54,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;

public class NetworkPartitionMetadataClient implements PartitionMetadataClient {
public class NetworkPartitionMetadataClient implements org.apache.kafka.server.util.PartitionMetadataClient {
Copy link
Collaborator

@smjn smjn Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we remove the fqcn in favor of just the class name?

@@ -177,14 +177,14 @@ public void testListLatestOffsetsSuccess() throws ExecutionException, Interrupte
Set<TopicPartition> partitions = new HashSet<>();
partitions.add(tp);

Map<TopicPartition, CompletableFuture<PartitionMetadataClient.OffsetResponse>> futures =
Map<TopicPartition, CompletableFuture<org.apache.kafka.server.util.PartitionMetadataClient.OffsetResponse>> futures =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

networkPartitionMetadataClient.listLatestOffsets(partitions);

assertNotNull(futures);
assertEquals(1, futures.size());
assertTrue(futures.containsKey(tp));

PartitionMetadataClient.OffsetResponse response = futures.get(tp).get();
org.apache.kafka.server.util.PartitionMetadataClient.OffsetResponse response = futures.get(tp).get();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

Copy link
Collaborator

@smjn smjn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, the NetworkPartitionMetadata seems general enough to be used by other coordinator runtime specializations as well so makes sense to move it to a general module.

Minor comments related to class name import and use.

@smjn smjn added KIP-932 Queues for Kafka ci-approved and removed triage PRs from the community labels Feb 10, 2026
@github-actions github-actions bot added the small Small PRs label Feb 10, 2026
@chirag-wadhwa5 chirag-wadhwa5 requested a review from smjn February 10, 2026 13:03
Copy link
Collaborator

@smjn smjn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, LGTM

Copy link
Contributor

@squah-confluent squah-confluent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch!

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.kafka.coordinator.group;
package org.apache.kafka.server;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we also put this in org.apache.kafka.server.util?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. NetworkPartitionMetadataClient uses MetadataCache which is present in the metadata module. Since server-common is already a dependency of metadata, moving NetworkPartitionMetadataClient would create a cyclic dependency. That's why NetworkPartitionMetadataClient was moved to the server module instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the package within server, not the module.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh ok, my bad. I have made that change in the latest commit.

Copy link
Contributor

@apoorvmittal10 apoorvmittal10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@apoorvmittal10 apoorvmittal10 merged commit a603bf1 into apache:trunk Feb 12, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-approved core Kafka Broker group-coordinator KIP-932 Queues for Kafka small Small PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants