MINOR: Replace ConfiguredTopology with TopologyValidationResult#21436
Draft
lucasbru wants to merge 1 commit intoapache:trunkfrom
Draft
MINOR: Replace ConfiguredTopology with TopologyValidationResult#21436lucasbru wants to merge 1 commit intoapache:trunkfrom
lucasbru wants to merge 1 commit intoapache:trunkfrom
Conversation
c4f2973 to
b8306f3
Compare
This refactoring simplifies the streams group coordinator by replacing the ConfiguredTopology, ConfiguredSubtopology, and ConfiguredInternalTopic classes with a simpler TopologyValidationResult record. The key changes are: TopologyValidationResult is a new record that captures the validation state of a topology, including the topology epoch, internal topics to be created, any configuration exceptions, and an optional maxPartitionsPerSubtopology map when the topology is ready. Storing only the pre-computed map instead of TopologyMetadata avoids retaining a reference to CoordinatorMetadataImage in Timeline collections. TopologyMetadata is now a lightweight class that accepts pre-computed partition counts and StreamsTopology. It is constructed on-the-fly in TargetAssignmentBuilder when needed, rather than being stored in TopologyValidationResult. InternalTopicManager.configureTopics now returns TopologyValidationResult with maxPartitionsPerSubtopology directly instead of TopologyMetadata. The computeAllMaxPartitions method was moved from TopologyMetadata to InternalTopicManager. StreamsGroup stores TopologyValidationResult instead of ConfiguredTopology, with renamed accessor methods. TargetAssignmentBuilder now accepts both TopologyValidationResult and StreamsTopology via withTopology(), and constructs TopologyMetadata on the fly when the topology is ready. EndpointToPartitionsManager now takes StreamsTopology directly as a parameter instead of fetching it from StreamsGroup, which fixes a timing issue during heartbeat processing. The three Configured* classes and their tests are deleted as they are no longer needed.
b8306f3 to
bb0d8af
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This refactoring simplifies the streams group coordinator by replacing
the
ConfiguredTopology,ConfiguredSubtopology, andConfiguredInternalTopicclasses with a simplerTopologyValidationResultrecord.TopologyValidationResultis a new record that captures the validationstate of a topology, including the topology epoch, internal topics to be
created, any configuration exceptions, and an optional
maxPartitionsPerSubtopologymap when the topology is ready. Storingonly the pre-computed map (instead of
TopologyMetadata) avoidsretaining a reference to
CoordinatorMetadataImagein Timelinecollections.
TopologyMetadatais now a lightweight class that accepts pre-computedpartition counts and
StreamsTopology. It is constructed on-the-fly inTargetAssignmentBuilderwhen needed, rather than being stored inTopologyValidationResult. ThecomputeAllMaxPartitionsmethod wasmoved from
TopologyMetadatatoInternalTopicManager.InternalTopicManager.configureTopicsnow returnsTopologyValidationResultwithmaxPartitionsPerSubtopologydirectly.The topology metadata is only created when all required topics exist.
StreamsGroupstoresTopologyValidationResultinstead ofConfiguredTopology, with renamed accessor methods.TargetAssignmentBuildernow accepts bothTopologyValidationResultand
StreamsTopologyviawithTopology(), and constructsTopologyMetadataon the fly when the topology is ready.EndpointToPartitionsManagernow takesStreamsTopologydirectly as aparameter instead of fetching it from
StreamsGroup, which fixes atiming issue during heartbeat processing.
The three
Configured*classes and their tests are deleted as they areno longer needed.
The
jmh-benchmarksmodule has been updated to use the newTopologyMetadataconstructor withStreamsTopologyand pre-computedmax partitions.
Test plan
TopologyValidationResultTest,TopologyMetadataTest,InternalTopicManagerTest,TargetAssignmentBuilderTest,EndpointToPartitionsManagerTest,StreamsGroupTestGroupMetadataManagerTesttests pass (410+ tests)