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

Support LogAppend timestamps #1258

Merged
merged 2 commits into from
Feb 6, 2019
Merged

Conversation

zimin2000
Copy link
Contributor

@zimin2000 zimin2000 commented Jan 16, 2019

Currently sarama doesn't seem to properly support LogAppend type of timestamps. The patch is addressing this issue. The following was used is the reference for the change:

@varun06
Copy link
Contributor

varun06 commented Jan 17, 2019

Looks okay to me, I wonder who else can review it?

{nil, testMsg, 1, now.Add(time.Second)},
{nil, testMsg, 2, now.Add(2 * time.Second)},
}, []time.Time{now.Add(time.Second), now.Add(2 * time.Second)}},
{V0_11_0_0, true, []testMessage{

Choose a reason for hiding this comment

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

Should you include other supported versions here?

https://github.com/bai/sarama/blob/master/utils.go#L163

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 have adjusted the test to cover all versions for which format of fetch is different (from https://github.com/bai/sarama/blob/0a21d90df4f6266fdf28d603e5ef91f2426c362a/fetch_request.go#L141)

@zimin2000
Copy link
Contributor Author

@sam-obeid , @varun06 , how else I can help with the PR to make it through ?

@@ -355,10 +357,13 @@ func encodeKV(key, value Encoder) ([]byte, []byte) {
return kb, vb
}

func (r *FetchResponse) AddMessage(topic string, partition int32, key, value Encoder, offset int64) {
func (r *FetchResponse) AddMessageWithTimestamp(topic string, partition int32, key, value Encoder, offset int64, timestamp time.Time, version int8) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This and below are exported function and this change is going to be a breaking change. Let's see how we can handle them. @bai do you have an idea?

Copy link

@sam-obeid sam-obeid Feb 4, 2019

Choose a reason for hiding this comment

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

You'll need to keep both exported functions, and make one delegate to the other!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@varun06 , I think I did preserve the original API call reimplementing the original function using this one (https://github.com/Shopify/sarama/pull/1258/files/e1eda41894f763094e70b74f6dbf958c4cbbd315#diff-be942b2617e64413fb251f24e4bd4ea2R388). Same for AddRecord.

Am I missing something ?

Copy link
Contributor

Choose a reason for hiding this comment

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

This name change gonna break for folks who are using exported method "AddMessage".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The “AddMessage” method is still there (check the link I provided above). Also note that there are multiple tests that would have got broken otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

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

Apologies, Do we have AddRecord method also?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, “AddRecord” also kept.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool Bean. Let's get it going then. @bai can we merge this please?

@varun06
Copy link
Contributor

varun06 commented Feb 4, 2019

@zimin2000 there are couple breaking changes(exported function names are changed), we got bitten by last merge, so let's walk carefully now and find a holistic approach to handle these changes.

@bai
Copy link
Contributor

bai commented Feb 6, 2019

Thanks for contributing!

@bai bai merged commit a6c1f7e into IBM:master Feb 6, 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.

4 participants