You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "CalvinConfluent (via GitHub)" <gi...@apache.org> on 2023/04/06 04:13:35 UTC

[GitHub] [kafka] CalvinConfluent commented on a diff in pull request #13489: KAFKA-14617: Fill broker epochs to the AlterPartitionRequest

CalvinConfluent commented on code in PR #13489:
URL: https://github.com/apache/kafka/pull/13489#discussion_r1159263750


##########
core/src/main/scala/kafka/cluster/Partition.scala:
##########
@@ -992,6 +1003,11 @@ class Partition(val topicPartition: TopicPartition,
     }
   }
 
+  private def isBrokerEpochIsrEligible(storedBrokerEpoch: Option[Long], cachedBrokerEpoch: Option[Long]): Boolean = {
+    storedBrokerEpoch.isDefined && cachedBrokerEpoch.isDefined &&
+      (storedBrokerEpoch.get == -1 || (storedBrokerEpoch == cachedBrokerEpoch))

Review Comment:
   In the case of _storedBrokerEpoch_ and _ cachedBrokerEpoch_ are both null, it should return false. Without the second bracket, it will return true.



##########
core/src/main/scala/kafka/cluster/Partition.scala:
##########
@@ -992,6 +1003,11 @@ class Partition(val topicPartition: TopicPartition,
     }
   }
 
+  private def isBrokerEpochIsrEligible(storedBrokerEpoch: Option[Long], cachedBrokerEpoch: Option[Long]): Boolean = {
+    storedBrokerEpoch.isDefined && cachedBrokerEpoch.isDefined &&
+      (storedBrokerEpoch.get == -1 || (storedBrokerEpoch == cachedBrokerEpoch))

Review Comment:
   In the case of _storedBrokerEpoch_ and _cachedBrokerEpoch_ are both null, it should return false. Without the second bracket, it will return true.



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org