Skip to content

Comments

MINOR: use new method to get number of topics in DeleteTopicsRequest#10351

Merged
dajac merged 5 commits intoapache:trunkfrom
jolshan:deleteFixes
Mar 23, 2021
Merged

MINOR: use new method to get number of topics in DeleteTopicsRequest#10351
dajac merged 5 commits intoapache:trunkfrom
jolshan:deleteFixes

Conversation

@jolshan
Copy link
Member

@jolshan jolshan commented Mar 18, 2021

As a result of #9684, a new field for topic names was created. For versions 6+ DeleteTopicsRequestData.topicNames will return an empty list in KafkaApis. This PR uses a new method to efficiently initialize the size of the collection.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@jolshan
Copy link
Member Author

jolshan commented Mar 18, 2021

Build was broken due to an unrelated change, but should be fixed now.

@dajac
Copy link
Member

dajac commented Mar 19, 2021

@jolshan You need to rebase to include a065fa5. The build won't work otherwise.

Copy link
Member

@dajac dajac left a comment

Choose a reason for hiding this comment

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

@jolshan Thanks for the updates. I have left few minor comments.

assertEquals(topics, requestWithNames2.topicNames());
assertEquals(topics, requestWithNamesSerialized2.topicNames());

} catch (UnsupportedVersionException e) {
Copy link
Member

Choose a reason for hiding this comment

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

It would be better to use assertThrows instead of doing this because it is not clear where we expect this exception to be thrown. So, I would so something like the following:

if (version >= 6) {
   // Do the regular part
} else {
  // assertThrows with the expected code that must throw. 
}

// All topic names should be replaced with null
requestWithIds.data().topics().forEach(topic -> assertNull(topic.name()));
requestWithIdsSerialized.data().topics().forEach(topic -> assertNull(topic.name()));
} catch (UnsupportedVersionException e) {
Copy link
Member

Choose a reason for hiding this comment

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

ditto.

Copy link
Member

@dajac dajac left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

@dajac dajac merged commit 3d0b4d9 into apache:trunk Mar 23, 2021
Terrdi pushed a commit to Terrdi/kafka that referenced this pull request Apr 1, 2021
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