You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/06/07 00:13:10 UTC

[GitHub] [kafka] junrao commented on a diff in pull request #12250: KAFKA-13935 Fix static usages of IBP in KRaft mode

junrao commented on code in PR #12250:
URL: https://github.com/apache/kafka/pull/12250#discussion_r890589316


##########
core/src/main/scala/kafka/server/KafkaConfig.scala:
##########
@@ -1790,38 +1790,13 @@ class KafkaConfig private(doLog: Boolean, val props: java.util.Map[_, _], dynami
   // We keep the user-provided String as `MetadataVersion.fromVersionString` can choose a slightly different version (eg if `0.10.0`
   // is passed, `0.10.0-IV0` may be picked)
   val interBrokerProtocolVersionString = getString(KafkaConfig.InterBrokerProtocolVersionProp)
-  val interBrokerProtocolVersion = MetadataVersion.fromVersionString(interBrokerProtocolVersionString)
-
-  val fetchRequestVersion: Short =
-    if (interBrokerProtocolVersion.isAtLeast(IBP_3_1_IV0)) 13
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_2_7_IV1)) 12
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_2_3_IV1)) 11
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_2_1_IV2)) 10
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_2_0_IV1)) 8
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_1_1_IV0)) 7
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_0_11_0_IV1)) 5
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_0_11_0_IV0)) 4
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_0_10_1_IV1)) 3
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_0_10_0_IV0)) 2
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_0_9_0)) 1
-    else 0
-
-  val offsetForLeaderEpochRequestVersion: Short =
-    if (interBrokerProtocolVersion.isAtLeast(IBP_2_8_IV0)) 4
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_2_3_IV1)) 3
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_2_1_IV1)) 2
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_2_0_IV0)) 1
-    else 0
-
-  val listOffsetRequestVersion: Short =
-    if (interBrokerProtocolVersion.isAtLeast(IBP_3_0_IV1)) 7
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_2_8_IV0)) 6
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_2_2_IV1)) 5
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_2_1_IV1)) 4
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_2_0_IV1)) 3
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_0_11_0_IV0)) 2
-    else if (interBrokerProtocolVersion.isAtLeast(IBP_0_10_1_IV2)) 1
-    else 0
+  val interBrokerProtocolVersion = if (processRoles.isEmpty) {

Review Comment:
   There are still a few places referencing this static value (Partition, GroupCoordinator, etc). Should we change them to use MetadataVersion?



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