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

add CreatePartitionsRequest/Response #985

Merged
merged 2 commits into from
Dec 8, 2017
Merged

add CreatePartitionsRequest/Response #985

merged 2 commits into from
Dec 8, 2017

Conversation

buyology
Copy link

this adds the request/response pair for CreatePartitions

@buyology buyology changed the title add CreatePartitions/Response add CreatePartitionsRequest/Response Nov 17, 2017
@buyology
Copy link
Author

buyology commented Nov 19, 2017

sorry for the multiple pushes. realised — while writing up some of the other new request/response pairs (I have all of the acl-request/responses, 29-31, almost done as well) — some style-related things and fixed a small error in the getNullableString-decoder that had previously prevented me from using it.

re: travis — seems to be related to the fact that the Apache mirror only has 0.10.2.1, 0.11.0.2 and 1.0.0 now.

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.

Thanks for this, just a few minor things.

@@ -44,6 +44,10 @@ func (pe *prepEncoder) putArrayLength(in int) error {
return nil
}

func (pe *prepEncoder) putBool(in bool) {
pe.length++
Copy link
Contributor

Choose a reason for hiding this comment

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

might be tempted to just delegate this to putInt8 since that's the effective implementation elsewhere

Copy link
Author

Choose a reason for hiding this comment

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

the above is mostly for symmetry :) bool is quite common in the new request/responses + just thinking it's nice to have getBool() sanity check for valid values. what do you think. is it ok to leave in?

real_decoder.go Outdated
tmp, err := rd.getInt16()
if err != nil || tmp == -1 {
str, err := rd.getString()
if err != nil || str == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the whole point of nullable strings was to distinguish between a length of -1 (null) and a length of 0 ("") which this check doesn't do, because getString already turns them both into "".

Copy link
Author

Choose a reason for hiding this comment

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

I factored out getStringLength() now to allow for exactly this logic. the problem with the former getNullableString() impl was that it consumed the length so when calling out to getString() the output became corrupted.

return nil
}

pe.putInt32(int32(len(t.Assignment)))
Copy link
Contributor

Choose a reason for hiding this comment

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

putArrayLength

Copy link
Author

Choose a reason for hiding this comment

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

Done

}

type TopicPartition struct {
Count int32
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm looking at https://kafka.apache.org/protocol.html#The_Messages_CreateTopics and this doesn't seem quite right. Aren't you missing the number of replication factor?

Copy link
Author

@buyology buyology Dec 5, 2017

Choose a reason for hiding this comment

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

Hm. This is actually https://kafka.apache.org/protocol#The_Messages_CreatePartitions, so it's only about adding about new partitions to an already existing topic.

Copy link
Contributor

Choose a reason for hiding this comment

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

🤦‍♂️ alright then

@eapache
Copy link
Contributor

eapache commented Dec 8, 2017

Thanks!

@eapache eapache merged commit 0e0650f into IBM:master Dec 8, 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