KAFKA-20566: Improve logging in share coordinator#22257
Open
AndrewJSchofield wants to merge 2 commits into
Open
KAFKA-20566: Improve logging in share coordinator#22257AndrewJSchofield wants to merge 2 commits into
AndrewJSchofield wants to merge 2 commits into
Conversation
chia7712
reviewed
May 12, 2026
| if (topicMetadataOp.isEmpty() || | ||
| topicMetadataOp.get().partitionCount() <= partitionId) { | ||
| log.error("Topic/TopicPartition not found in metadata image."); | ||
| log.error("Topic or partition not found in metadata image when initializing: {}:null-{}.", topicId, partitionId); |
Member
There was a problem hiding this comment.
Maybe we should try our best to resolve the topic name here?
log.error("Topic or partition not found in metadata image when initializing: {}:{}-{}.", topicId,
topicMetadataOp.map(CoordinatorMetadataImage.TopicMetadata::name).orElse("null"), partitionId);
smjn
suggested changes
May 14, 2026
| topicMetadataOp.get().partitionCount() <= partitionId) { | ||
| log.error("Topic/TopicPartition not found in metadata image."); | ||
| log.error("Topic or partition not found in metadata image when writing: {}:{}-{}.", topicId, | ||
| topicMetadataOp.map(CoordinatorMetadataImage.TopicMetadata::name).orElse("null"), partitionId); |
Collaborator
There was a problem hiding this comment.
lets encapsulate this in a private method for readability
Member
Author
There was a problem hiding this comment.
I've taken a look at this and I don't think it helps. If I just make the log.error line a private method, it probably harms the readability because it's a trivial method and I can't see what it does without going to the method.
If I instead take the entire if block, that is also tricky because the construction of the error response is operation-dependent.
So I prefer to leave as is in this case.
smjn
approved these changes
May 15, 2026
Collaborator
smjn
left a comment
There was a problem hiding this comment.
Thanks for the changes, LGTM
FrankYang0529
approved these changes
May 16, 2026
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.
This PR just improves the logging for situations in which the metadata
image in the share coordinator does not contain an expected topic ID. We
see this log line in some situations but because there are 5 instances
with identical text, it's not possible to tell from the log alone which
one is responsible.
Reviewers: Chia-Ping Tsai chia7712@gmail.com, Sushant Mahajan
smahajan@confluent.io, PoAn Yang payang@apache.org