cmccabe commented on a change in pull request #10931: URL: https://github.com/apache/kafka/pull/10931#discussion_r663271546
########## File path: core/src/main/scala/kafka/server/FinalizedFeatureCache.scala ########## @@ -127,6 +131,22 @@ class FinalizedFeatureCache(private val brokerFeatures: BrokerFeatures) extends } } + def update(featuresDelta: FeaturesDelta, highestMetadataOffset: Long): Unit = { + val features = featuresAndEpoch.getOrElse( + FinalizedFeaturesAndEpoch(Features.emptyFinalizedFeatures(), -1)) + val newFeatures = new util.HashMap[String, FinalizedVersionRange]() + newFeatures.putAll(features.features.features()) + featuresDelta.changes().entrySet().forEach { e => + e.getValue().asScala match { + case None => newFeatures.remove(e.getKey) + case Some(feature) => newFeatures.put(e.getKey, + new FinalizedVersionRange(feature.min(), feature.max())) + } + } + featuresAndEpoch = Some(FinalizedFeaturesAndEpoch( + Features.finalizedFeatures(newFeatures), highestMetadataOffset)) Review comment: Yeah, let's do it. This shouldn't change often. -- 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org