-
Notifications
You must be signed in to change notification settings - Fork 14.9k
MINOR: Cleanup in SharePartition acknowledgement functionality #21236
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
Conversation
apoorvmittal10
left a comment
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.
Looks good, minor comment.
| RecordState recordState = ACK_TYPE_TO_RECORD_STATE.get(ackType); | ||
| Objects.requireNonNull(recordState); |
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.
RecordState recordState = Objects.requireNonNull(ACK_TYPE_TO_RECORD_STATE.get(ackType));
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 don't think we require Objects.requireNonNull()since this code would be covered when we perform fetchAckTypeMapForBatch and it should be covered there. Hence, I thought to remove it.
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.
For now ofcourse yes, but the check was placed so one do not forget to update the ACK_TYPE_TO_RECORD_STATE map while adding new values.
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.
then maybe lets not have Objects.requireNonNull since it throws a NullPointerException, rather we throw an IllegalRequestException or InvalidRequestException, wdyt?
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.
Anything is fine but some exception should highlight the map is missing the required 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.
done
AndrewJSchofield
left a comment
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 PR. Looks good to me.
apoorvmittal10
left a comment
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 change, LGTM!
About
This PR performs cleanup in
SharePartition.javaacknowledgement flow. We do not needObjects.requireNonNull(recordState);firstly because this has been covered in this code. Also throwing aNullPointerExceptionis indeed wrong for an invalid acknowledge type provided by the client.Testing
Added some unit tests.