Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-4108: Improve DumpLogSegments offsets-decoder output format #1937

Closed
wants to merge 2 commits into from

Conversation

vahidhashemian
Copy link
Contributor

@vahidhashemian vahidhashemian commented Sep 29, 2016

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]}"}

@asfbot
Copy link

asfbot commented Jan 14, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/883/
Test FAILed (JDK 8 and Scala 2.12).

@asfbot
Copy link

asfbot commented Jan 14, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/885/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Jan 14, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/883/
Test FAILed (JDK 7 and Scala 2.10).

@ijuma
Copy link
Contributor

ijuma commented Sep 28, 2017

@hachikuji, does this seem OK to you?

Copy link
Contributor

@hachikuji hachikuji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch. Couple questions.

val keyString = Json.encode(Map("metadata" -> groupId))
val valueString = Json.encode(Map(
"protocolType" -> protocolType,
"groupMetadata.protocol" -> group.protocol,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why do we use the "groupMetadata" prefix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it's been a while :) Perhaps to somehow reflect the object/value they are describing. I could remove the prefix in the next update.

"protocolType" -> protocolType,
"groupMetadata.protocol" -> group.protocol,
"groupMetadata.generationId" -> group.generationId,
"assignment" -> assignment))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we jsonify the assignment too, or do you think it's ok as is?

Copy link
Contributor Author

@vahidhashemian vahidhashemian Sep 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment value is already stringified in the previous block. So I think we could keep it.

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","groupMetadata.protocol":"range","groupMetadata.generationId":1,"assignment":"{consumer-1-20240b92-fbf4-44d5-bf8c-66b6d70c9948=[foo-0]}"}
```
Copy link
Contributor Author

@vahidhashemian vahidhashemian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hachikuji Thanks for taking a look. I'll submit an update shortly to address your comments.

val keyString = Json.encode(Map("metadata" -> groupId))
val valueString = Json.encode(Map(
"protocolType" -> protocolType,
"groupMetadata.protocol" -> group.protocol,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it's been a while :) Perhaps to somehow reflect the object/value they are describing. I could remove the prefix in the next update.

"protocolType" -> protocolType,
"groupMetadata.protocol" -> group.protocol,
"groupMetadata.generationId" -> group.generationId,
"assignment" -> assignment))
Copy link
Contributor Author

@vahidhashemian vahidhashemian Sep 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment value is already stringified in the previous block. So I think we could keep it.

@ijuma
Copy link
Contributor

ijuma commented Oct 3, 2017

Anything preventing this from being merged? Code freeze is tomorrow.

@vahidhashemian
Copy link
Contributor Author

Thanks for the heads-up. Just waiting for @hachikuji's feedback on my responses above and the new commit.

@hachikuji
Copy link
Contributor

LGTM. I went back to the JIRA and was surprised to find that I filed this issue 😝 .

@asfgit asfgit closed this in 5663f51 Oct 3, 2017
efeg pushed a commit to efeg/kafka that referenced this pull request May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants