Skip to content

Conversation

@VictorDenisov
Copy link
Contributor

I would like to merge this as a separate PR for easier review. I will need this change is implementing v2 message reader: #146
I'll be using this request right after connecting to kafka cluster in order to determine which fetch requests I'm allowed to send.
So far the plan is to implement fetch request v5. Fetch request v5 seems to have been introduced in kafka 0.11.0.0. And presumably this is the first version where server returns message sets in v2 format.
So, if fetch request v5 is available I'll be sending v5 otherwise v2.

This was referenced Dec 19, 2018
Copy link
Contributor

@achille-roussel achille-roussel left a comment

Choose a reason for hiding this comment

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

Looking good overall, just left a couple of questions.

}

if errorCode != 0 {
return r, Error(errorCode)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we return a nil []ApiVersion here? Or is there value in exposing a partial result?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My approach was, - I'm giving you whatever I have just use it at your own discretion since there was an error. I can return nil here if you think it makes more sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

Up to you, I don't have strong feelings about it.

conn.go Outdated
var err error
c.apiVersions, err = c.ApiVersions()
if err != nil {
c.apiVersions = nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we put a default value here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I can put the value that lists all the versions that the current implementation of kafka-go works with.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like it could help making good use of this field 👍

conn.go Outdated

// number of replica acks required when publishing to a partition
requiredAcks int32
apiVersions []ApiVersion
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a guarantee on the ordering of the values here? I'm wondering how the lookups will work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can check for ordering. But I just realized that for our purposes it, probably, makes more sense to put it in a map: map[api key]ApiVersion

Copy link
Contributor

Choose a reason for hiding this comment

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

A map makes sense to me 👍

@VictorDenisov
Copy link
Contributor Author

@achille-roussel, I addressed the comments.

@achille-roussel
Copy link
Contributor

Looking good, thanks for adding this!

@achille-roussel achille-roussel merged commit 266d14d into segmentio:master Jan 9, 2019
@VictorDenisov VictorDenisov deleted the api_versions branch January 12, 2019 18:58
@stevevls stevevls mentioned this pull request Feb 8, 2019
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