-
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-16709: abortAndPauseCleaning only when future log is not existed #15951
Changes from all commits
57fd500
e644536
4a1b76d
3e6a880
d913971
9a6da74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -2114,25 +2114,24 @@ class ReplicaManager(val config: KafkaConfig, | |||
partition.log.foreach { _ => | ||||
val leader = BrokerEndPoint(config.brokerId, "localhost", -1) | ||||
|
||||
// Add future replica log to partition's map | ||||
partition.createLogIfNotExists( | ||||
isNew = false, | ||||
isFutureReplica = true, | ||||
offsetCheckpoints, | ||||
topicIds(partition.topic)) | ||||
|
||||
// pause cleaning for partitions that are being moved and start ReplicaAlterDirThread to move | ||||
// replica from source dir to destination dir | ||||
logManager.abortAndPauseCleaning(topicPartition) | ||||
// Add future replica log to partition's map if it's not existed | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If However, adding alter thread ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's possible. But I think that's fine because the removal of future log could because:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, my previous comments is incorrect. Both However, I'm thinking whether it is fine to add alter thread by In short, [0]
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chia7712 , thanks for the comment.
I chose latter option because if we only create fetcher when future log is inexisted, it might cause potential side effect that this fetcher is removed when leadership change, but not get added later. I've added the comment in this commit: 0d78e49 . Thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if it's not existed => if it doesn't exist |
||||
if (partition.maybeCreateFutureReplica(futureLog.parentDir, offsetCheckpoints, topicIds(partition.topic))) { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sincre this section is inside a block of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, normally, when we created future log is in this path:
So in the end, we'll have future log added in both But it's possible that the future log only exists in That means, we have to do the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Given that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need a way to determine if That is, Sorry, maybe I didn't get your question here. Could you explain again if I misunderstand it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The scenario I was thinking of is when the broker starts up, But you're right, my confusion here was with where maybeCreateFutureReplica checks if the futureLog already exists, it checks in itself (Partition) not in LogManager, so this makes sense. |
||||
// pause cleaning for partitions that are being moved and start ReplicaAlterDirThread to move | ||||
// replica from source dir to destination dir | ||||
logManager.abortAndPauseCleaning(topicPartition) | ||||
} | ||||
|
||||
futureReplicasAndInitialOffset.put(topicPartition, InitialFetchState(topicIds(topicPartition.topic), leader, | ||||
partition.getLeaderEpoch, futureLog.highWatermark)) | ||||
} | ||||
} | ||||
} | ||||
|
||||
if (futureReplicasAndInitialOffset.nonEmpty) | ||||
if (futureReplicasAndInitialOffset.nonEmpty) { | ||||
// Even though it's possible that there is another thread adding fetcher for this future log partition, | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, |
||||
// but it's fine because `BrokerIdAndFetcherId` will be identical and the operation will be no-op. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When the leader changes, we need to propagate the new leader epoch to ReplicaAlterLogDirsThread (see #8223). So, the operation is not a no-op? |
||||
replicaAlterLogDirsManager.addFetcherForPartitions(futureReplicasAndInitialOffset) | ||||
} | ||||
} | ||||
|
||||
/* | ||||
|
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.
Could we add the new param to the javadoc?