chia7712 commented on code in PR #15652:
URL: https://github.com/apache/kafka/pull/15652#discussion_r1551795883


##########
core/src/main/scala/kafka/tools/DumpLogSegments.scala:
##########
@@ -398,9 +399,34 @@ object DumpLogSegments {
     }
   }
 
-  private class OffsetsMessageParser extends MessageParser[String, String] {
+  // Package private for testing.
+  class OffsetsMessageParser extends MessageParser[String, String] {
+    private val serde = new RecordSerde()
+
     override def parse(record: Record): (Option[String], Option[String]) = {
-      GroupMetadataManager.formatRecordKeyAndValue(record)
+      if (!record.hasKey)
+        throw new RuntimeException(s"Failed to decode message at offset 
${record.offset} using offset " +
+          "topic decoder (message had a missing key)")
+
+      try {
+        val r = serde.deserialize(record.key, record.value)
+        (
+          Some(r.key.message.toString),
+          Option(r.value).map(_.message.toString).orElse(Some("<DELETE>"))

Review Comment:
   It seems the `r.value` is never null ( 
https://github.com/apache/kafka/blob/376e9e20dbf7c7aeb6f6f666d47932c445eb6bd1/group-coordinator/src/main/java/org/apache/kafka/coordinator/group/RecordSerde.java#L101
 )



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