Skip to content

MINOR: create KafkaConfigSchema and TimelineObject#11809

Merged
cmccabe merged 3 commits intoapache:trunkfrom
cmccabe:controller-refactors
Mar 2, 2022
Merged

MINOR: create KafkaConfigSchema and TimelineObject#11809
cmccabe merged 3 commits intoapache:trunkfrom
cmccabe:controller-refactors

Conversation

@cmccabe
Copy link
Copy Markdown
Contributor

@cmccabe cmccabe commented Feb 25, 2022

Create KafkaConfigSchema to encapsulate the concept of determining the types of configuration keys. This is useful in the controller because we can't import KafkaConfig, which is part of core. Also introduce the TimelineObject class, which is a more generic version of TimelineInteger / TimelineLong.

Create KafkaConfigSchema to encapsulate the concept of determining the types of configuration keys.
This is useful in the controller because we can't import KafkaConfig, which is part of core. Also
introduce the TimelineObject class, which is a more generic version of TimelineInteger /
TimelineLong.
@cmccabe cmccabe force-pushed the controller-refactors branch from e680476 to 74faa70 Compare February 28, 2022 20:19
Copy link
Copy Markdown
Member

@mumrah mumrah left a comment

Choose a reason for hiding this comment

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

Thanks, @cmccabe! It's nice to see the ConfigDef code moved out of ConfigurationControlManager. I think this change looks good. Two non-critical comments inline

import static java.util.Collections.emptyMap;


public class KafkaConfigSchema {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add a brief javadoc explaining the purpose of this class?

Comment on lines +184 to +185
ConfigResource.Type.BROKER -> KafkaConfig.configDef,
ConfigResource.Type.TOPIC -> LogConfig.configDefCopy,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I realize this is just copied over from ControllerServer, but why do we make a copy of the LogConfig but not KafkaConfig here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In practice nobody mutates either of these. But you're right, it is inconsistent. I will do a defensive copy on the KafkaConfig one.

In the future we should have a freeze method or something on the ConfigDef to make these defensive copies unnecessary. But that's out of scope here...

@cmccabe cmccabe force-pushed the controller-refactors branch from e1b6b69 to 034344d Compare March 2, 2022 22:18
@cmccabe cmccabe merged commit 07553d1 into apache:trunk Mar 2, 2022
@cmccabe cmccabe deleted the controller-refactors branch March 2, 2022 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants