Skip to content
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

Added support for FetchRequest protocol version 3. #905

Merged
merged 3 commits into from
Jun 30, 2017
Merged

Conversation

sp1ff
Copy link

@sp1ff sp1ff commented Jun 29, 2017

This commit will add the 'MaxBytes' field to FetchRequests when the Kafka version is
0.10.1 or better (i.e. it adds support for V3 of the FetchRequest API). On send, it will be set to MaxResponseSize.

Michael Herstine added 2 commits June 15, 2017 12:19
This commit will add the 'MaxBytes' field to FetchRequests when the Kafka version is
0.10.1 or better. On send, it will be set to MaxResponseSize. No tests, yet.
This commit adds support for version 3 of the FetchRequest API. The
KIP can be found here:

    https://cwiki.apache.org/confluence/display/KAFKA/KIP-74%3A+Add+Fetch+Response+Size+Limit+in+Bytes

the PR here:

    apache/kafka#1812

and the JIRA here:

    https://issues.apache.org/jira/browse/KAFKA-2063

Should document the fact that the per-partition limits take
precedence (so the returned message may be larger than the
requested limit).
Copy link
Contributor

@eapache eapache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this looks pretty good. Just have a few questions.

fetch_request.go Outdated
@@ -32,6 +36,9 @@ func (r *FetchRequest) encode(pe packetEncoder) (err error) {
pe.putInt32(-1) // replica ID is always -1 for clients
pe.putInt32(r.MaxWaitTime)
pe.putInt32(r.MinBytes)
if 3 == r.Version {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r.Version == 3 is more consistent with the rest of the code, and with the check you added below

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old habits die hard; fixed in my latest commit.

consumer.go Outdated
@@ -726,6 +726,10 @@ func (bc *brokerConsumer) fetchNewMessages() (*FetchResponse, error) {
if bc.consumer.conf.Version.IsAtLeast(V0_10_0_0) {
request.Version = 2
}
if bc.consumer.conf.Version.IsAtLeast(V0_10_1_0) {
request.Version = 3
request.MaxBytes = MaxResponseSize - 47 // TODO(mherstin): WTF?!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the comment: where did the value of 47 come from?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's embarrassing-- this was removed in a subsequent commit which I forgot to push. Fixed.

@eapache
Copy link
Contributor

eapache commented Jun 30, 2017

Thanks!

@eapache eapache merged commit 2fd980e into IBM:master Jun 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants