-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
base: trunk
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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. |
There was a problem hiding this comment.
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:
// 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed it
There was a problem hiding this 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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure :)
topicId.foreach(log.assignTopicId) | ||
} | ||
|
||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Jira: https://issues.apache.org/jira/browse/KAFKA-18545
Committer Checklist (excluded from commit message)