Skip to content

MINOR: Clean up core server classes#15272

Merged
jlprat merged 2 commits intoapache:trunkfrom
jlprat:MINOR-cleanup-core-part2
Jan 31, 2024
Merged

MINOR: Clean up core server classes#15272
jlprat merged 2 commits intoapache:trunkfrom
jlprat:MINOR-cleanup-core-part2

Conversation

@jlprat
Copy link
Copy Markdown
Contributor

@jlprat jlprat commented Jan 26, 2024

Follow up from #15252

Mark methods and fields private where possible:

  • Annotate public methods and fields
  • Remove unused classes and methods
  • Make sure Arrays are not printed with .toString
  • Optimize minor warnings

Committer Checklist (excluded from commit message)

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

case Some(partition) =>
if (!partition.replicas.contains(brokerId)) {
info(s"Found stray log dir $log: the current replica assignment ${partition.replicas} " +
info(s"Found stray log dir $log: the current replica assignment ${partition.replicas.mkString("Array(", ", ", ")")} " +
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.

This actually should have printed the memory reference and not the contents. With the current version, it prints the contents.

Comment thread core/src/main/scala/kafka/server/AutoTopicCreationManager.scala Outdated
val configProps = conf.dynamicConfig.fromPersistentProps(persistentProps, perBrokerConfig)
val alterConfigOps = resource.configs().asScala.map {
case config =>
config =>
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.

Previous code was the standard in really old version of Scala, since then anonymous function style is preferred.

): AlterConfigsResponseData = {
val response = new AlterConfigsResponseData()
val responsesByResource = persistentResponses.responses().iterator().asScala.map {
case r => (r.resourceName(), r.resourceType()) -> new ApiError(r.errorCode(), r.errorMessage())
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.

Previous code was the standard in really old version of Scala, since then anonymous function style is preferred.

def describeConfigs(resourceToConfigNames: List[DescribeConfigsResource],
includeSynonyms: Boolean,
includeDocumentation: Boolean): List[DescribeConfigsResponseData.DescribeConfigsResult] = {
resourceToConfigNames.map { case resource =>
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.

Previous code was the standard in really old version of Scala, since then anonymous function style is preferred.

}
quotaDelta.changes().entrySet().forEach { e =>
handleUserClientQuotaChange(userClientEntity, e.getKey, e.getValue.asScala.map(_.toDouble))
handleUserClientQuotaChange(userClientEntity, e.getKey, e.getValue.asScala)
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.

The map to Double wasn't needed as it was already a double

@jlprat
Copy link
Copy Markdown
Contributor Author

jlprat commented Jan 26, 2024

@showuon if you have some time, this is a follow up of the one you reviewed already.

Copy link
Copy Markdown
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, pending a good CI result

@jlprat jlprat force-pushed the MINOR-cleanup-core-part2 branch from 206fc68 to 96d67cd Compare January 30, 2024 08:29
@jlprat
Copy link
Copy Markdown
Contributor Author

jlprat commented Jan 30, 2024

Needed to rebase because of merge conflicts

Mark methods and fields private where possible
Annotate public methods and fields
Remove unused classes and methods
Make sure Arrays are not printed with .toString
Optimize minor warnings
Signed-off-by: Josep Prat <josep.prat@aiven.io>
@jlprat jlprat force-pushed the MINOR-cleanup-core-part2 branch from 96d67cd to 7f08216 Compare January 30, 2024 12:32
@jlprat
Copy link
Copy Markdown
Contributor Author

jlprat commented Jan 30, 2024

Rebased again to contain #15290

@jlprat
Copy link
Copy Markdown
Contributor Author

jlprat commented Jan 31, 2024

I checked that all tests pass locally, and the failures in CI seem all unrelated to the changes.

@jlprat jlprat merged commit cfc8257 into apache:trunk Jan 31, 2024
@jlprat jlprat deleted the MINOR-cleanup-core-part2 branch January 31, 2024 12:52
yyu1993 pushed a commit to yyu1993/kafka that referenced this pull request Feb 15, 2024
* MINOR: Clean up core server classes

Mark methods and fields private where possible
Annotate public methods and fields
Remove unused classes and methods
Make sure Arrays are not printed with .toString
Optimize minor warnings
Remove unused apply method

Signed-off-by: Josep Prat <josep.prat@aiven.io>

Reviewers: Mickael Maison <mickael.maison@gmail.com>
clolov pushed a commit to clolov/kafka that referenced this pull request Apr 5, 2024
* MINOR: Clean up core server classes

Mark methods and fields private where possible
Annotate public methods and fields
Remove unused classes and methods
Make sure Arrays are not printed with .toString
Optimize minor warnings
Remove unused apply method

Signed-off-by: Josep Prat <josep.prat@aiven.io>

Reviewers: Mickael Maison <mickael.maison@gmail.com>
Phuc-Hong-Tran pushed a commit to Phuc-Hong-Tran/kafka that referenced this pull request Jun 6, 2024
* MINOR: Clean up core server classes

Mark methods and fields private where possible
Annotate public methods and fields
Remove unused classes and methods
Make sure Arrays are not printed with .toString
Optimize minor warnings
Remove unused apply method

Signed-off-by: Josep Prat <josep.prat@aiven.io>

Reviewers: Mickael Maison <mickael.maison@gmail.com>
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