Skip to content

MINOR: Some cleanups and additional testing for KIP-88#2383

Closed
hachikuji wants to merge 3 commits intoapache:trunkfrom
hachikuji:minor-cleanup-kip-88
Closed

MINOR: Some cleanups and additional testing for KIP-88#2383
hachikuji wants to merge 3 commits intoapache:trunkfrom
hachikuji:minor-cleanup-kip-88

Conversation

@hachikuji
Copy link
Copy Markdown
Contributor

No description provided.

@hachikuji
Copy link
Copy Markdown
Contributor Author

cc @vahidhashemian @ijuma

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 16, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/895/
Test FAILed (JDK 8 and Scala 2.11).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 16, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/893/
Test FAILed (JDK 8 and Scala 2.12).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 16, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/893/
Test FAILed (JDK 7 and Scala 2.10).

@vahidhashemian
Copy link
Copy Markdown
Contributor

LGTM. Thanks for improving the code for KIP-88.

Copy link
Copy Markdown
Member

@ijuma ijuma 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 the PR, it's a good improvement in terms of readability. I left a few comments, two of them affect the behaviour and are important to address.

}


private List<Struct> getTopicArray(Map<TopicPartition, PartitionData> responseData) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking at this method initially, I thought it should be static since we are passing responseData as a parameter instead of accessing the field, but then I noticed that we access the struct field. Is there a reason why it's done this way? Maybe we should remove the existing parameter or pass both as parameters.

Also, should the method name be topicArray?

*/
public OffsetFetchResponse(Errors topLevelError) {
this(topLevelError, new ArrayList<TopicPartition>(), CURRENT_VERSION);
public OffsetFetchResponse(Errors error, Map<TopicPartition, PartitionData> responseData) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it worth adding a comment to this constructor? Maybe stating the version.

case None =>
// Return offsets for all partitions owned by this consumer group. (this only applies to consumers
// that commit offsets to Kafka.)
group.allOffsets.mapValues { offsetAndMetadata =>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

mapValues returns a view over the original collection (annoyingly), which means that the returned map can change after it's returned if group.allOffsets is updated. This doesn't seem to be what we want here.


assertEquals((Errors.NONE, Map.empty), groupCoordinator.handleFetchOffsets(groupId))

val commitOffsetResult = commitOffsets(groupId, OffsetCommitRequest.DEFAULT_MEMBER_ID,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: maybe we could commit at least 2 offsets to verify that the code really returns all instead of just one?

offsetFetchRequest.getErrorResponse(error)
else {
// clients are not allowed to see offsets for topics that are not authorized for Describe
val authorizedPartitionData = allPartitionData.filterKeys(authorizeTopicDescribe)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

filterKeys (like mapValues) returns a view over the original collection. That means that calling get on the resulting map would call authorize which is not what we want.

@hachikuji
Copy link
Copy Markdown
Contributor Author

@ijuma Thanks for reviewing. Pushed another commit to address your comments.

@ijuma
Copy link
Copy Markdown
Member

ijuma commented Jan 17, 2017

LGTM, thanks.

@asfgit asfgit closed this in 7a84b24 Jan 17, 2017
asfgit pushed a commit that referenced this pull request Jan 17, 2017
Author: Jason Gustafson <jason@confluent.io>

Reviewers: Vahid Hashemian <vahidhashemian@us.ibm.com>, Ismael Juma <ismael@juma.me.uk>

Closes #2383 from hachikuji/minor-cleanup-kip-88
@asfbot
Copy link
Copy Markdown

asfbot commented Jan 17, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/935/
Test FAILed (JDK 8 and Scala 2.11).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 17, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/933/
Test FAILed (JDK 8 and Scala 2.12).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 17, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/933/
Test FAILed (JDK 7 and Scala 2.10).

soenkeliebau pushed a commit to soenkeliebau/kafka that referenced this pull request Feb 7, 2017
Author: Jason Gustafson <jason@confluent.io>

Reviewers: Vahid Hashemian <vahidhashemian@us.ibm.com>, Ismael Juma <ismael@juma.me.uk>

Closes apache#2383 from hachikuji/minor-cleanup-kip-88
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