hachikuji commented on code in PR #12071:
URL: https://github.com/apache/kafka/pull/12071#discussion_r855411055
##########
core/src/main/scala/kafka/cluster/Partition.scala:
##########
@@ -251,8 +251,9 @@ class Partition(val topicPartition: TopicPartition,
// lock to prevent the follower replica log update while checking if the log
dir could be replaced with future log.
private val futureLogLock = new Object()
- private var zkVersion: Int = LeaderAndIsr.initialZKVersion
- @volatile private var leaderEpoch: Int = LeaderAndIsr.initialLeaderEpoch - 1
+ // The current epoch for the partition for KRaft controllers. The current ZK
version for the legacy controllers.
+ private var partitionEpoch: Int = LeaderAndIsr.InitialPartitionEpoch
Review Comment:
Do you know why this field is not volatile like `leaderEpoch`.
##########
clients/src/main/resources/common/message/LeaderAndIsrRequest.json:
##########
@@ -78,8 +78,8 @@
"about": "The leader epoch." },
{ "name": "Isr", "type": "[]int32", "versions": "0+", "entityType":
"brokerId",
"about": "The in-sync replica IDs." },
- { "name": "ZkVersion", "type": "int32", "versions": "0+",
- "about": "The ZooKeeper version." },
+ { "name": "PartitionEpoch", "type": "int32", "versions": "0+",
+ "about": "The current epoch for the partition for KRaft controllers.
The current ZK version for the legacy controllers." },
Review Comment:
nit: It does seem a little misleading to mention KRaft here since
`LeaderAndIsr` is not used. Maybe we could somehow call that out?
More generally, do you know if there is a good place we can document
assumptions about the partition epoch? Mainly looking for a good place we can
document that it is a monotonically increasing value which is incremented after
every partition change. Maybe `kafka.api.LeaderAndIsr`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]