KAFKA-9293; Fix NPE in DumpLogSegments offsets parser and display tombstone keys - #7820
Merged
Conversation
hachikuji
force-pushed
the
KAFKA-9293
branch
from
December 11, 2019 22:57
ac6c3f8 to
77a3852
Compare
mumrah
reviewed
Jan 2, 2020
| /** | ||
| * Exposed for printing records using [[kafka.tools.DumpLogSegments]] | ||
| */ | ||
| def formatRecordKeyAndValue(record: Record): (Option[String], Option[String]) = { |
Member
There was a problem hiding this comment.
Can one or the other string be missing? Or will they always be present or absent together? Just wondering if this should be Option[Pair[String, String]] or something
Contributor
Author
There was a problem hiding this comment.
I agree the API is a bit awkward, but I think both cases are possible. For example, a tombstone will have a key, but not a value.
mumrah
reviewed
Jan 2, 2020
| val txnKey = TransactionLog.readTxnRecordKey(record.key) | ||
| val keyString = s"transaction_metadata::transactionalId=${txnKey.transactionalId}" | ||
|
|
||
| val txnMetadata = TransactionLog.readTxnRecordValue(txnKey.transactionalId, record.value) |
Member
There was a problem hiding this comment.
Should we change readTxnRecordValue to return an Option? Glancing at that code, it looks like another possible NPE in TransactionStateManager#loadTransactions
Contributor
Author
There was a problem hiding this comment.
Yeah, good suggestion. Pushed a change.
hachikuji
added a commit
that referenced
this pull request
Jan 3, 2020
…bstone keys (#7820) Fixes an NPE when UserData in a member's subscription is null and adds similar checks for transaction log parser. Also modifies the output logic so that we show the keys of tombstones for both group and transaction metadata. Reviewers: David Arthur <mumrah@gmail.com>
qq619618919
pushed a commit
to qq619618919/kafka
that referenced
this pull request
May 12, 2020
…bstone keys (apache#7820) Fixes an NPE when UserData in a member's subscription is null and adds similar checks for transaction log parser. Also modifies the output logic so that we show the keys of tombstones for both group and transaction metadata. Reviewers: David Arthur <mumrah@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes an NPE when UserData in a member's subscription is null. Also modifies the output logic so that we show the keys of tombstones for both group and transaction metadata. Also adds test cases.
Committer Checklist (excluded from commit message)