-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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-18694: Migrate suitable classes to recorods in coordinator-common module #18782
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 for the patch. I have some minor comments.
private record TaskResult<R>(R result, Throwable exception) { | ||
} |
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.
Could we merge them into one line?
private record TaskResult<R>(R result, Throwable exception) { | |
} | |
private record TaskResult<R>(R result, Throwable exception) { } |
record LoadSummary(long startTimeMs, long endTimeMs, long schedulerQueueTimeMs, long numRecords, long numBytes) { | ||
} |
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.
ditto
private record Timestamped<T>(long timestamp, T value) { | ||
} |
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.
ditto
Thanks for the comments.Fixed. |
@Override | ||
public String toString() { | ||
return "LoadSummary(" + | ||
"startTimeMs=" + startTimeMs + | ||
", endTimeMs=" + endTimeMs + | ||
", schedulerQueueTimeMs=" + schedulerQueueTimeMs + | ||
", numRecords=" + numRecords + | ||
", numBytes=" + numBytes + ")"; | ||
} |
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.
Record the default toString method will show "Square brackets" instead "Parentheses", ie. LoadSummary(...)
will change to LoadSummary[...]
, If won't broken any test, I think it will be OK.
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.
@Rancho-7, thanks for this patch, LGTM
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.
LGTM
How are you evaluating if these classes can be safely converted? There are clear differences in behavior in equals/hashCode after these changes. |
Hi @ijuma Thanks for catching this issue.You make a good point about the different behaviors in equals/hashCode. While the Java SE docs mention these differences:
in our implementation we're actually comparing the object fields directly rather than using equals() for object comparison.E.g: Line 96 in 852f140
kafka/group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java Line 2505 in 852f140
And we don't invoke hashCode() directly either. Based on this approach, I believe these conversions should maintain compatibility without issues. |
jira: https://issues.apache.org/jira/browse/KAFKA-18694
As title.
Committer Checklist (excluded from commit message)