TaiJuWu commented on code in PR #18591:
URL: https://github.com/apache/kafka/pull/18591#discussion_r1919860145


##########
core/src/test/scala/unit/kafka/server/MetadataCacheTest.scala:
##########
@@ -55,6 +55,29 @@ object MetadataCacheTest {
       MetadataCache.kRaftMetadataCache(1, () => KRaftVersion.KRAFT_VERSION_0)
     )
 
+  def updateCache(cache: MetadataCache, records: Seq[ApiMessage]): Unit = {
+    cache match {
+      case c: KRaftMetadataCache => {
+        val image = c.currentImage()
+        val partialImage = new MetadataImage(
+          new MetadataProvenance(100L, 10, 1000L, true),
+          image.features(),
+          ClusterImage.EMPTY,
+          image.topics(),
+          image.configs(),
+          image.clientQuotas(),
+          image.producerIds(),
+          image.acls(),
+          image.scram(),
+          image.delegationTokens())
+        val delta = new MetadataDelta.Builder().setImage(partialImage).build()
+        records.foreach(record => delta.replay(record))
+        c.setImage(delta.apply(new MetadataProvenance(100L, 10, 1000L, true)))
+      }
+      case _ => throw new RuntimeException("Unsupported cache type")
+    }
+  }
+
   def updateCache(cache: MetadataCache, request: UpdateMetadataRequest, 
records: Seq[ApiMessage] = List()): Unit = {

Review Comment:
   This method will be removed in 
https://issues.apache.org/jira/browse/KAFKA-18578



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

Reply via email to