dajac commented on code in PR #12071:
URL: https://github.com/apache/kafka/pull/12071#discussion_r855443278


##########
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:
   It seems that `partitionEpoch` is always accessed within the 
`leaderIsrUpdateLock` lock whereas `leaderEpoch` is also accessed by the 
`ReplicaManager`. Do you think that we should make it volatile to be consistent?



-- 
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]

Reply via email to