Skip to content

KAFKA-18533: Remove KafkaConfig zookeeper related logic#18547

Merged
chia7712 merged 18 commits intoapache:trunkfrom
m1a2st:KAFKA-18533
Jan 25, 2025
Merged

KAFKA-18533: Remove KafkaConfig zookeeper related logic#18547
chia7712 merged 18 commits intoapache:trunkfrom
m1a2st:KAFKA-18533

Conversation

@m1a2st
Copy link
Copy Markdown
Collaborator

@m1a2st m1a2st commented Jan 15, 2025

as title

Committer Checklist (excluded from commit message)

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

@github-actions github-actions Bot added triage PRs from the community core Kafka Broker small Small PRs labels Jan 15, 2025
@m1a2st
Copy link
Copy Markdown
Collaborator Author

m1a2st commented Jan 15, 2025

requiresZookeeper should wait for #18483 and #18508

# Conflicts:
#	core/src/main/scala/kafka/server/KafkaConfig.scala
# Conflicts:
#	core/src/main/scala/kafka/server/DynamicBrokerConfig.scala
#	core/src/main/scala/kafka/server/KafkaConfig.scala
#	core/src/main/scala/kafka/server/MetadataSupport.scala
#	core/src/test/scala/unit/kafka/server/KafkaConfigTest.scala
# Conflicts:
#	core/src/main/scala/kafka/controller/KafkaController.scala
@ijuma
Copy link
Copy Markdown
Member

ijuma commented Jan 18, 2025

This PR seems to be adding an empty Kafka controller file.

val zkConnectionTimeoutMs: Int =
Option(getInt(ZkConfigs.ZK_CONNECTION_TIMEOUT_MS_CONFIG)).map(_.toInt).getOrElse(getInt(ZkConfigs.ZK_SESSION_TIMEOUT_MS_CONFIG))
val zkEnableSecureAcls: Boolean = getBoolean(ZkConfigs.ZK_ENABLE_SECURE_ACLS_CONFIG)
val zkMaxInFlightRequests: Int = getInt(ZkConfigs.ZK_MAX_IN_FLIGHT_REQUESTS_CONFIG)
Copy link
Copy Markdown
Member

@ijuma ijuma Jan 22, 2025

Choose a reason for hiding this comment

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

Can we also remove them from ZkConfigs?

@github-actions github-actions Bot removed the triage PRs from the community label Jan 22, 2025
Copy link
Copy Markdown
Member

@ijuma ijuma 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, left a few comments.

contextLabels.put(BrokerIdLabel, config.brokerId.toString)
}

contextLabels.put(BrokerIdLabel, config.brokerId.toString)
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.

Hmm, this seems like a bug - we may want to add a unit test if nothing failed. We should be setting NodeIdLabel, not BrokerIdLabel. Right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In ServerTest.scala will test this bug, I think we won't need to add a new test for it.

val listenerNames = listeners.map(_.listenerName).toSet
if (processRoles.isEmpty || processRoles.contains(ProcessRole.BrokerRole)) {
// validations for all broker setups (i.e. ZooKeeper and KRaft broker-only and KRaft co-located)
// validations for all broker setups (i.e. KRaft broker-only and KRaft co-located)
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.

Shall we remove KRaft?

))
alterConfigs.put(topicResource2, util.Arrays.asList(new AlterConfigOp(new ConfigEntry(TopicConfig.COMPRESSION_TYPE_CONFIG, "snappy"), OpType.SET)))
alterConfigs.put(brokerResource, util.Arrays.asList(new AlterConfigOp(new ConfigEntry(ZkConfigs.ZK_CONNECT_CONFIG, "localhost:2181"), OpType.SET)))
alterConfigs.put(brokerResource, util.Arrays.asList(new AlterConfigOp(new ConfigEntry(KRaftConfigs.NODE_ID_CONFIG, "123"), OpType.SET)))
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.

Hmm, it would be weird to update the node id, can we pick a config that makes more sense to update? Same for other cases similar to this one.

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.

@m1a2st thanks for this cleanup. please take a look at one small comment

}

public static final ConfigDef CONFIG_DEF = new ConfigDef()
.define(ZK_CONNECT_CONFIG, STRING, null, HIGH, ZK_CONNECT_DOC)
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.

Could you please add those configs to zk2kraft.html?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think these config already on zk2kraft.html

截圖 2025-01-24 上午9 08 34

import static org.apache.kafka.common.config.ConfigDef.Type.PASSWORD;
import static org.apache.kafka.common.config.ConfigDef.Type.STRING;

public final class ZkConfigs {
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.

open https://issues.apache.org/jira/browse/KAFKA-18631 to remove this config file

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.

LGTM and one small comment remains

if (config.usesSelfManagedQuorum) {
contextLabels.put(NodeIdLabel, config.nodeId.toString)
} else {
contextLabels.put(BrokerIdLabel, config.brokerId.toString)
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.

Please remove BrokerIdLabel and MockMetricsReporter.BROKERID

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

addressed it :)

@github-actions github-actions Bot removed the small Small PRs label Jan 24, 2025
@chia7712 chia7712 merged commit c40e7a1 into apache:trunk Jan 25, 2025
@mingyen066 mingyen066 mentioned this pull request Jan 25, 2025
3 tasks
@chia7712
Copy link
Copy Markdown
Member

this PR is related to zk configs cleanup, so I'm going to backport to 4.0

chia7712 pushed a commit that referenced this pull request Jan 25, 2025
Reviewers: Ismael Juma <ismael@juma.me.uk>, Chia-Ping Tsai <chia7712@gmail.com>
pranavt84 pushed a commit to pranavt84/kafka that referenced this pull request Jan 27, 2025
Reviewers: Ismael Juma <ismael@juma.me.uk>, Chia-Ping Tsai <chia7712@gmail.com>
airlock-confluentinc Bot pushed a commit to confluentinc/kafka that referenced this pull request Jan 27, 2025
Reviewers: Ismael Juma <ismael@juma.me.uk>, Chia-Ping Tsai <chia7712@gmail.com>
props.setProperty(KRaftConfigs.CONTROLLER_LISTENER_NAMES_CONFIG, "CONTROLLER")
props.setProperty(KRaftConfigs.NODE_ID_CONFIG, "1")
props.setProperty(SocketServerConfigs.LISTENERS_CONFIG, "PLAINTEXT://localhost:0,CONTROLLER://localhost:5000")
props.setProperty(QuorumConfig.QUORUM_VOTERS_CONFIG, "2@localhost:5000")
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.

this config is invalid. It uses combined mode so the id should be aligned with node.id. 2@localhost:5000 -> 1@localhost:5000 - otherwise, the test cases using this config will always get invalid KafkaConfig

@mingyen066 Could you please file a minor to fix it? @m1a2st is busy today

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yeah, I've create a minor fix PR
#18815

pdruley pushed a commit to pdruley/kafka that referenced this pull request Feb 12, 2025
Reviewers: Ismael Juma <ismael@juma.me.uk>, Chia-Ping Tsai <chia7712@gmail.com>
manoj-mathivanan pushed a commit to manoj-mathivanan/kafka that referenced this pull request Feb 19, 2025
Reviewers: Ismael Juma <ismael@juma.me.uk>, Chia-Ping Tsai <chia7712@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants