Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-15853: Move KafkaConfig.Defaults to server module #15158

Merged
merged 5 commits into from
Jan 22, 2024

Conversation

OmniaGM
Copy link
Collaborator

@OmniaGM OmniaGM commented Jan 9, 2024

first pr to break #15103

  • Moving any object companion that KafkaConfigs.Defaults depends on outside of core.
    • ClientQuotaManagerConfig, and ReplicationQuotaManagerConfig object companions moved to org.apache.kafka.server.config in another pr need to be merged first
    • TransactionLogConfig object companion moved to org.apache.kafka.coordinator.transaction
    • OffsetConfig moved to org.apache.kafka.coordinator.group

Committer Checklist (excluded from commit message)

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

@OmniaGM OmniaGM force-pushed the KAFKA-15853-1 branch 2 times, most recently from d2cd220 to 4f86d1e Compare January 9, 2024 14:55
@OmniaGM
Copy link
Collaborator Author

OmniaGM commented Jan 9, 2024

@mimaison @ijuma can you have a look please?

*/
package org.apache.kafka.coordinator.transaction;

public class TransactionLogConfig {
Copy link
Member

Choose a reason for hiding this comment

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

Hey @OmniaGM. It is a bit weird to have those transaction classes in the group-coordinator module. It does not seem to be the correct place.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I feel the same but also not sure where they should move. They don't fit in server module either. I don't see any Jiras to move transaction coordinator out of server but maybe I can start a new module for transaction coordinator similar to the group one. Would this make more sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's see what @dajac says, but I think a kafka-transactions or kafka-transactions-coordinator module that depends on kafka-group-coordinator makes sense to me. The former option is shorter and as clear while the second follows the same pattern as for the group coordinator

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, creating a new module makes sense to me. I would call it transaction-coordinator and the jar would be called kafka-transaction-coordinator in order to follow the naming scheme of the group-coordinator. I am not sure if it really needs to depend on the group-coordinator module though but I haven't not checked the details.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I was using the maven name. I agree that we shouldn't add a dependency unless it exists.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added transaction-coordinator modules and moved theses there

@mimaison
Copy link
Member

@OmniaGM Can we rebase to resolve the conflicts? Thanks

@OmniaGM
Copy link
Collaborator Author

OmniaGM commented Jan 15, 2024

@OmniaGM Can we rebase to resolve the conflicts? Thanks

done now.

@mimaison
Copy link
Member

@OmniaGM It looks like there are a few build failures:

[Error] /home/jenkins/jenkins-agent/workspace/Kafka_kafka-pr_PR-15158/core/src/main/scala/kafka/server/DynamicConfig.scala:26:58: Unused import
[Error] /home/jenkins/jenkins-agent/workspace/Kafka_kafka-pr_PR-15158/core/src/main/scala/kafka/server/KafkaConfig.scala:47:50: Unused import

@OmniaGM
Copy link
Collaborator Author

OmniaGM commented Jan 16, 2024

@OmniaGM It looks like there are a few build failures:

[Error] /home/jenkins/jenkins-agent/workspace/Kafka_kafka-pr_PR-15158/core/src/main/scala/kafka/server/DynamicConfig.scala:26:58: Unused import
[Error] /home/jenkins/jenkins-agent/workspace/Kafka_kafka-pr_PR-15158/core/src/main/scala/kafka/server/KafkaConfig.scala:47:50: Unused import

fixed this

*/
package org.apache.kafka.coordinator.transaction;

public class TransactionLogConfig {
Copy link
Collaborator

@nizhikov nizhikov Jan 18, 2024

Choose a reason for hiding this comment

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

Can we introduce new module and config into separate PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it will be very small one which I don't believe it worth it.

Copy link
Member

@mimaison mimaison 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. It looks good overall, I just left a few suggestions

checkstyle/import-control-core.xml Outdated Show resolved Hide resolved
core/src/main/scala/kafka/server/KafkaConfig.scala Outdated Show resolved Hide resolved
core/src/test/scala/other/kafka/StressTestLog.scala Outdated Show resolved Hide resolved
core/src/test/scala/other/kafka/TestLinearWriteSpeed.scala Outdated Show resolved Hide resolved
Copy link
Member

@mimaison mimaison left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@mimaison mimaison merged commit 62ce551 into apache:trunk Jan 22, 2024
1 check failed
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

public class Defaults {
Copy link
Contributor

@ijuma ijuma Jan 22, 2024

Choose a reason for hiding this comment

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

What's the plan for these defaults, they will not be part of KafkaConfig anymore once that's moved to this module?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. They always have been separate object out side of KafkaConfig but in the same file. I just moved them out for reason no. 2
  2. Kafkaconfig cant be refactored into Java as one class as it is huge and breaks the complexity rules for the checkstyle. The plan is to keep them out as separate class.

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. If you look at the pattern in Java, the defaults are usually in the same file as the config file unless it's shared between many configs (then it's extracted).
  2. We can add an exception for checkstyle - it's a tool in the end.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the pattern of default and properties in the class object companion has been like this in some scala as well. KafkaConfig has been kinda of anti pattern for a while as the defaults are defined in another object companian. I will raise another pr soon to move this pr to Java pattern.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

pr opened here to refactor this #15260

drawxy pushed a commit to drawxy/kafka that referenced this pull request Jan 23, 2024
dajac added a commit that referenced this pull request Jan 29, 2024
The uniform assignor got accidentally removed by #15158. This patch adds it back. 

Reviewers: Omnia G H Ibrahim <[email protected]>, Mickael Maison <[email protected]>
yyu1993 pushed a commit to yyu1993/kafka that referenced this pull request Feb 15, 2024
yyu1993 pushed a commit to yyu1993/kafka that referenced this pull request Feb 15, 2024
The uniform assignor got accidentally removed by apache#15158. This patch adds it back. 

Reviewers: Omnia G H Ibrahim <[email protected]>, Mickael Maison <[email protected]>
clolov pushed a commit to clolov/kafka that referenced this pull request Apr 5, 2024
clolov pushed a commit to clolov/kafka that referenced this pull request Apr 5, 2024
The uniform assignor got accidentally removed by apache#15158. This patch adds it back. 

Reviewers: Omnia G H Ibrahim <[email protected]>, Mickael Maison <[email protected]>
Phuc-Hong-Tran pushed a commit to Phuc-Hong-Tran/kafka that referenced this pull request Jun 6, 2024
Phuc-Hong-Tran pushed a commit to Phuc-Hong-Tran/kafka that referenced this pull request Jun 6, 2024
The uniform assignor got accidentally removed by apache#15158. This patch adds it back. 

Reviewers: Omnia G H Ibrahim <[email protected]>, Mickael Maison <[email protected]>
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.

5 participants