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-18545 Remove Zookeeper logic from LogManager #18592

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

m1a2st
Copy link
Contributor

@m1a2st m1a2st commented Jan 17, 2025

Jira: https://issues.apache.org/jira/browse/KAFKA-18545

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 17, 2025
Copy link
Contributor

@frankvicky frankvicky 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 patch.
I left a comment, PTAL

@@ -354,7 +354,7 @@ class LogManager(logDirs: Seq[File],
addStrayLog(topicPartition, log)
warn(s"Loaded stray log: $logDir")
} else if (isStray(log)) {
// Unlike Zookeeper mode, which tracks pending topic deletions under a ZNode, KRaft is unable to prevent a topic from being recreated before every replica has been deleted.
// KRaft is unable to prevent a topic from being recreated before every replica has been deleted.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think simply deleting the zk statement is not enough, we should do a little rephrase for it.
How about like:

Suggested change
// KRaft is unable to prevent a topic from being recreated before every replica has been deleted.
// In KRaft, we are unable to prevent a topic from being recreated before every replica has been deleted.

The rest of statement we could leave it as what it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed it

Copy link
Contributor

@frankvicky frankvicky left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -354,8 +354,8 @@ class LogManager(logDirs: Seq[File],
addStrayLog(topicPartition, log)
warn(s"Loaded stray log: $logDir")
} else if (isStray(log)) {
// Unlike Zookeeper mode, which tracks pending topic deletions under a ZNode, KRaft is unable to prevent a topic from being recreated before every replica has been deleted.
// A KRaft broker with an offline directory may be unable to detect it still holds a to-be-deleted replica,
// In KRaft, we are unable to prevent a topic from being recreated before every replica has been deleted.
Copy link
Member

Choose a reason for hiding this comment

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

No reason to say "In KRaft", right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure :)

@github-actions github-actions bot removed the triage PRs from the community label Jan 18, 2025
topicId.foreach(log.assignTopicId)
}


Copy link
Member

Choose a reason for hiding this comment

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

Should we change the topid id so it's not optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Although this method doesn't utilize Optional's functionality internally, the calling method Partition#createLogIfNotExists uses Optional features, and Optional is still required when passing to the UnifiedLog constructor later. Therefore, I don't see a compelling reason to avoid using Optional at this point.

def createLogIfNotExists(isNew: Boolean, isFutureReplica: Boolean, offsetCheckpoints: OffsetCheckpoints, topicId: Option[Uuid],

private def initializeTopicId(): Unit = {

Copy link
Member

@ijuma ijuma Jan 18, 2025

Choose a reason for hiding this comment

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

Makes sense. Unrelated to this PR, but a good clean-up would be to extract the topic id creation so it's always set by the time the UnifiedLog constructor is called (the way it works now unnecessarily exposes an optional topic id even though it is never really optional with kraft).

Copy link
Contributor Author

@m1a2st m1a2st Jan 18, 2025

Choose a reason for hiding this comment

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

It a good idea, I will file a Jira to trace this issue.

Update: https://issues.apache.org/jira/browse/KAFKA-18586

Copy link
Member

Choose a reason for hiding this comment

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

we should do this cleanup after all zk-related paths are removed from ReplicaManager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-approved core Kafka Broker small Small PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants