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/02/10 17:40:28 UTC

[GitHub] [kafka] mimaison commented on a change in pull request #11603: MINOR: MetadataShell should handle ProducerIdsRecord

mimaison commented on a change in pull request #11603:
URL: https://github.com/apache/kafka/pull/11603#discussion_r803938280



##########
File path: shell/src/test/java/org/apache/kafka/shell/MetadataNodeManagerTest.java
##########
@@ -290,4 +293,47 @@ public void testClientQuotaRecord() {
             metadataNodeManager.getData().root().directory("client-quotas",
                 "user", "<default>").file("producer_byte_rate").contents());
     }
+
+    @Test
+    public void testProducerIdsRecord() {
+        // generate a producerId record
+        ProducerIdsRecord record1 = new ProducerIdsRecord()
+            .setBrokerId(0)
+            .setBrokerEpoch(1)
+            .setProducerIdsEnd(10000);
+        metadataNodeManager.handleMessage(record1);
+
+        assertEquals(
+            "0",
+            metadataNodeManager.getData().root().directory("lastProducerIdBlock").file("assignedBrokerId").contents());
+        assertEquals(
+            "1",
+            metadataNodeManager.getData().root().directory("lastProducerIdBlock").file("assignedBrokerEpoch").contents());
+        assertEquals(
+            10000 - ProducerIdsBlock.PRODUCER_ID_BLOCK_SIZE + "",
+            metadataNodeManager.getData().root().directory("lastProducerIdBlock").file("blockStart").contents());
+        assertEquals(
+            "9999",
+            metadataNodeManager.getData().root().directory("lastProducerIdBlock").file("blockEnd").contents());
+
+        // generate another brokerId

Review comment:
       nit: `brokerId` -> `producerId record`




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