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

Eos 201 list offsets v2 #209

Merged
merged 4 commits into from
Nov 22, 2018
Merged

Eos 201 list offsets v2 #209

merged 4 commits into from
Nov 22, 2018

Conversation

ianwsperber
Copy link
Contributor

@ianwsperber ianwsperber commented Nov 20, 2018

Resolves #201

Implement protocol ListOffsets v2, so that we can now provide an isolation level. For now continue with the default of "read_comitted".

The v2 response format is divergent from v0, as it returns a single offset rather than an array. AFAIK there's no pattern for normalizing responses (I'm unsure if that's even desirable), so I decided to handle it in an ad-hoc fashion within the cluster module.

Made the base branch eos so that this can land with the transactional producer & consumer.

@ianwsperber ianwsperber self-assigned this Nov 20, 2018
@ianwsperber ianwsperber changed the base branch from master to eos November 20, 2018 22:47
const listOffsets = this.lookupRequest(apiKeys.ListOffsets, requests.ListOffsets)
return await this.connection.send(listOffsets({ replicaId, topics }))
return await this.connection.send(listOffsets({ replicaId, isolationLevel, topics }))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest doing the normalization between versions here, rather than in the cluster. We don't really have an established pattern for where to normalize. We have done it in the protocol in some place (unfortunately I can't remember where...), but I think we should try to keep our protocol true to the Kafka protocol. But we shouldn't let that bleed through too far, like the cluster, so I think the broker is the best place for it that we have at the moment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I do like currently that the broker is a thin wrapper to execute the protocols. I also agree that we should not handle the normalization in the protocols (it's done for fetch with record sets vs messages, and it's giving me some trouble now that we're working with transactions). I think ideally there'd be a wrapper around the broker that did normalization. But I'm fine moving into the broker for now, just didn't want to introduce a new pattern without consensus 😄

@Nevon
Copy link
Collaborator

Nevon commented Nov 21, 2018

Looks good. 👏 Just don't forget that we need v1 as well.

@ianwsperber
Copy link
Contributor Author

ianwsperber commented Nov 21, 2018

@Nevon Are you just generally noting that we'd like to add ListOffsets v1? Or are you saying that it's necessary for this PR? I may have time to add regardless.

@tulios
Copy link
Owner

tulios commented Nov 22, 2018

KafkaJS generally assumes that all the versions in between the ranges are implemented so that we will need v1. I just checked, and it's similar to v2, but we can do it in another PR if you want.

@tulios tulios merged commit 2703cd5 into eos Nov 22, 2018
@tulios tulios deleted the eos-201-ListOffsets-v2 branch November 22, 2018 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants