Skip to content

MINOR: Refactor DynamicConfig#16133

Merged
chia7712 merged 3 commits intoapache:trunkfrom
mimaison:refactor-dynamic-config
May 31, 2024
Merged

MINOR: Refactor DynamicConfig#16133
chia7712 merged 3 commits intoapache:trunkfrom
mimaison:refactor-dynamic-config

Conversation

@mimaison
Copy link
Copy Markdown
Member

  • Remove direct dependency on KafkaConfig (still indirect via DynamicBrokerConfig)
  • Make DynamicConfig.Broker consistent with other dynamic configurations

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@mimaison great refactor! Please take a look at following small comments.


private def verifyReconfigurableConfigs(configNames: Set[String]): Unit = CoreUtils.inWriteLock(lock) {
val nonDynamic = configNames.filter(DynamicConfig.Broker.nonDynamicProps.contains)
val nonDynamic = configNames.filter(nonDynamicProps.contains)
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.

How about configNames.intersect(nonDynamicProps)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nice suggestion!

// Exclude message.format.version for now since we need to check that the version
// is supported on all brokers in the cluster.
@nowarn("cat=deprecation")
val ExcludedConfigs = Set(ServerLogConfigs.LOG_MESSAGE_FORMAT_VERSION_CONFIG)
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.

Do we need this variable? Maybe we can remove it by following change.

  // Exclude message.format.version for now since we need to check that the version
  // is supported on all brokers in the cluster.
  @nowarn("cat=deprecation")
  val ReconfigurableConfigs = ServerTopicConfigSynonyms.TOPIC_CONFIG_SYNONYMS.values.asScala.toSet - ServerLogConfigs.LOG_MESSAGE_FORMAT_VERSION_CONFIG

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've inlined this variable but we need to keep it as a Set for the - operator to work

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 don't run it actually, but IIRC "-" operator should work. See following screenshot

image

Please correct me for my Scala education 😄

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

My bad, you are correct! I was trying to use the -- operator, hence why it needed both operands to be Sets. With - we don't need the Set. Thanks

@chia7712 chia7712 merged commit b6d0fb0 into apache:trunk May 31, 2024
wernerdv pushed a commit to wernerdv/kafka that referenced this pull request Jun 3, 2024
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
TaiJuWu pushed a commit to TaiJuWu/kafka that referenced this pull request Jun 8, 2024
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
gongxuanzhang pushed a commit to gongxuanzhang/kafka that referenced this pull request Jun 12, 2024
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
@mimaison mimaison deleted the refactor-dynamic-config branch June 12, 2024 10:46
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