-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
[WIP] KAFKA-19053: Remove FetchResponse#of which is not used in production … #19327
base: trunk
Are you sure you want to change the base?
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.
@apalan60 : Thanks for the PR. Left a comment.
@@ -220,14 +220,6 @@ public static int recordsSize(FetchResponseData.PartitionData partition) { | |||
return partition.records() == null ? 0 : partition.records().sizeInBytes(); | |||
} | |||
|
|||
// TODO: remove as a part of KAFKA-12410 |
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 remove the TODO for the other of
constructor?
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 your review.
The other of
constructor is currently used by KafkaApis
in production code. I'm looking into alternative approaches to remove this dependency, so that we can achieve the deletion behavior mentioned in the TODO comment. I'll update the thread if I manage to come up with a viable solution.
If I've misunderstood anything, please let me know.
Are all the tests we deleted for the |
.setLastStableOffset(lastStableOffset) | ||
.setLogStartOffset(0) | ||
.setRecords(records)); | ||
return FetchResponse.of(Errors.NONE, throttleTime, sessionId, new LinkedHashMap<>(partitions)); |
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 FetchResponse.of
is not used in production code, but we still need to use another function to replace it in test code. Probably, you can modify this kind of function like following and add related client.prepareResponse
back in the test code.
private FetchResponse fullFetchResponse(int sessionId, TopicIdPartition tp, MemoryRecords records, Errors error, long hw,
long lastStableOffset, int throttleTime) {
return new FetchResponse(new FetchResponseData()
.setThrottleTimeMs(throttleTime)
.setErrorCode(Errors.NONE.code())
.setSessionId(sessionId)
.setResponses(List.of(
new FetchResponseData.FetchableTopicResponse()
.setTopic(tp.topic())
.setTopicId(tp.topicId())
.setPartitions(List.of(
new FetchResponseData.PartitionData()
.setPartitionIndex(tp.topicPartition().partition())
.setErrorCode(error.code())
.setHighWatermark(hw)
.setLastStableOffset(lastStableOffset)
.setLogStartOffset(0)
.setRecords(records))
))));
}
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 review.
I really appreciate your detailed explanation and pointing out my mistake.
I’ll try out your suggested solution and update the PR accordingly.
Thanks for the review. Thanks again for pointing that out. I'll update the PR soon with an improved version. |
No description provided.