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

fetchTopicOffsets should return low watermarks #333

Merged

Conversation

sklose
Copy link
Contributor

@sklose sklose commented Apr 8, 2019

enhances the admin client's fetchTopicOffsets function to return the low + high watermarks for the topic. this is related to #316

I kept the existing offset field so it's backwards compatible and added high + low (offset and high are equivalent)

high: offset,
}))

for (const { partition, offset } of low.pop().partitions) {
Copy link
Collaborator

@Nevon Nevon Apr 9, 2019

Choose a reason for hiding this comment

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

Took me a minute to understand that this was mutating offsets. How about moving this into the map above instead? Something like:

const { partitions: lowPartitions } = low.pop()
const offsets = partitions.map(({ partition, offset }) => ({
  partition,
  offset,
  high: offset,
  low: lowPartitions.find(({ partition: lowPartition }) => lowPartition === partition).offset
}))

This is assuming that all partitions present in high would also be present in low, but I see no reason they wouldn't be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, fixed

@Nevon Nevon self-requested a review April 9, 2019 07:29
@Nevon Nevon merged commit cd7b3cf into tulios:master Apr 10, 2019
@Nevon
Copy link
Collaborator

Nevon commented Apr 10, 2019

Great, thanks!

@sklose sklose deleted the feature/low-watermark-offsets-admin-client branch April 10, 2019 10:17
@Nevon Nevon mentioned this pull request Sep 10, 2020
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