MINOR: Replace ConfiguredTopology with TopologyValidationResult #21436
+717
−1,026
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)