-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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-7687: Print batch level information in DumpLogSegments #5976
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @huxihx . Left some minor suggestions to consider.
@@ -289,7 +289,7 @@ object DumpLogSegments { | |||
} | |||
lastOffset = record.offset | |||
|
|||
print("offset: " + record.offset + " position: " + validBytes + | |||
print("- offset: " + record.offset + " position: " + validBytes + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's some redundant information that we can exclude if we are printing the batch info: position, timestamp type, magic version, compression codec. Below we can also exclude the producerId, epoch, and the transactional flag.
Also, what do you think about using |
instead of -
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates. Just two more comments.
print(" producerId: " + batch.producerId + " producerEpoch: " + batch.producerEpoch + " sequence: " + record.sequence + | ||
" isTransactional: " + batch.isTransactional + | ||
" headerKeys: " + record.headers.map(_.key).mkString("[", ",", "]")) | ||
print(" sequence: " + record.sequence + " headerKeys: " + record.headers.map(_.key).mkString("[", ",", "]")) | ||
} else { | ||
print(" crc: " + record.checksumOrNull) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old format still has individual record level checksums. I think it would make sense to add back " isvalid: " + record.isValid
here.
" " + batch.timestampType + ": " + record.timestamp + " isvalid: " + record.isValid + | ||
" keysize: " + record.keySize + " valuesize: " + record.valueSize + " magic: " + batch.magic + | ||
" compresscodec: " + batch.compressionType) | ||
print(s"$INDENT offset: ${record.offset} keysize: ${record.keySize} valuesize: ${record.valueSize}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, the timestamp is a per-record field, so can we add batch.timestampType + ": " + record.timestamp
back to this string?
…p iterating DumpLogSegment should be able to print batch level information when deep-iteration is specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@huxihx Thanks, LGTM. I pushed a minor change to only display isvalid
when there is a corresponding checksum. If it looks good to you, I will go ahead and merge.
@hachikuji That's fine to me. Looks it's a more reasonable change. |
…p iterating (apache#5976) DumpLogSegments should print batch level information when deep-iteration is specified. Reviewers: Jason Gustafson <jason@confluent.io>
DumpLogSegment should be able to print batch level information when deep-iteration is specified
More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.
Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.
Committer Checklist (excluded from commit message)