kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject kafka git commit: KAFKA-4108; Improve DumpLogSegments offsets-decoder output format
Date Tue, 03 Oct 2017 17:44:38 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 9e35a2aa7 -> 5663f51ed


KAFKA-4108; Improve DumpLogSegments offsets-decoder output format

This PR improves the output format of DumpLogSegments when the `--offset-decoder` option is
used for consuming `__consumer_offsets`, especially when it comes to group metadata.

An example of the partial output with existing formatting:

```
key: metadata::console-consumer-40190 payload: consumer:range:1:{consumer-1-20240b92-fbf4-44d5-bf8c-66b6d70c9948=[foo-0]}
```

An example of the same output with suggested formatting:

```
key: {"metadata":"console-consumer-40190"} payload: {"protocolType":"consumer","protocol":"range","generationId":1,"assignment":"{consumer-1-20240b92-fbf4-44d5-bf8c-66b6d70c9948=[foo-0]}"}
```

Author: Vahid Hashemian <vahidhashemian@us.ibm.com>

Reviewers: Jason Gustafson <jason@confluent.io>

Closes #1937 from vahidhashemian/KAFKA-4108


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/5663f51e
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/5663f51e
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/5663f51e

Branch: refs/heads/trunk
Commit: 5663f51edfeb8f642fe74955021d6f38e9d9abe4
Parents: 9e35a2a
Author: Vahid Hashemian <vahidhashemian@us.ibm.com>
Authored: Tue Oct 3 10:44:11 2017 -0700
Committer: Jason Gustafson <jason@confluent.io>
Committed: Tue Oct 3 10:44:11 2017 -0700

----------------------------------------------------------------------
 core/src/main/scala/kafka/tools/DumpLogSegments.scala | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/5663f51e/core/src/main/scala/kafka/tools/DumpLogSegments.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/tools/DumpLogSegments.scala b/core/src/main/scala/kafka/tools/DumpLogSegments.scala
index c4f7ce0..8bf43b2 100755
--- a/core/src/main/scala/kafka/tools/DumpLogSegments.scala
+++ b/core/src/main/scala/kafka/tools/DumpLogSegments.scala
@@ -334,8 +334,12 @@ object DumpLogSegments {
         }
       }.mkString("{", ",", "}")
 
-      val keyString = s"metadata::$groupId"
-      val valueString = s"$protocolType:${group.protocol}:${group.generationId}:$assignment"
+      val keyString = Json.encode(Map("metadata" -> groupId))
+      val valueString = Json.encode(Map(
+          "protocolType" -> protocolType,
+          "protocol" -> group.protocol,
+          "generationId" -> group.generationId,
+          "assignment" -> assignment))
 
       (Some(keyString), Some(valueString))
     }


Mime
View raw message