Skip to content

MINOR: Remove topic null check from TopicIdPartition and adjust constructor order#11403

Merged
ijuma merged 2 commits intoapache:trunkfrom
ijuma:topic-id-partition-tweaks
Nov 10, 2021
Merged

MINOR: Remove topic null check from TopicIdPartition and adjust constructor order#11403
ijuma merged 2 commits intoapache:trunkfrom
ijuma:topic-id-partition-tweaks

Conversation

@ijuma
Copy link
Copy Markdown
Member

@ijuma ijuma commented Oct 15, 2021

TopicPartition allows a null topic and there are cases where we have
a topic id, but no topic name. Even for TopicIdPartition, the non null
topic name check was only enforced in one constructor.

Also adjust the constructor order to move the nullable parameter to the
end, update tests and javadoc.

Committer Checklist (excluded from commit message)

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

…structor order

`TopicPartition` allows a null `topic` and there are cases where we have
a topic id, but no topic name. Even for `TopicIdPartition`, the non null
topic name check was only enforced in one constructor.

Also adjust the constructor order to move the nullable parameter to the
end, update tests and javadoc.
@ijuma ijuma requested a review from dajac October 15, 2021 16:29
@ijuma
Copy link
Copy Markdown
Member Author

ijuma commented Oct 15, 2021

cc @jolshan

Copy link
Copy Markdown
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.

Copy link
Copy Markdown
Member

@showuon showuon left a comment

Choose a reason for hiding this comment

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

LGTM. Left a minor comment. Thanks.


/**
* @return the topic name.
* @return the topic name or null.
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.

I think we should add more explanation for null return value:
ex: @return the topic name or null if there's only topic ID set.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not sure if that adds any value. The topic id is always set, so how is saying "there's only topic id set" helping? Maybe "the topic name or null if it is unknown"?

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.

You're right. "the topic name or null if it is unknown" is what I meant.

@dajac
Copy link
Copy Markdown
Member

dajac commented Nov 9, 2021

@ijuma Could we merge this PR?

@ijuma
Copy link
Copy Markdown
Member Author

ijuma commented Nov 9, 2021

@dajac I'll merge after the build completes.

@dajac
Copy link
Copy Markdown
Member

dajac commented Nov 9, 2021

Thanks @ijuma. Could you also cherry-pick to 3.1 branch?

@ijuma ijuma merged commit b8c3a67 into apache:trunk Nov 10, 2021
ijuma added a commit that referenced this pull request Nov 10, 2021
…structor order (#11403)

`TopicPartition` allows a null `topic` and there are cases where we have
a topic id, but no topic name. Even for `TopicIdPartition`, the non null
topic name check was only enforced in one constructor.

Also adjust the constructor order to move the nullable parameter to the
end, update tests and javadoc.

Reviewers: David Jacot <djacot@confluent.io>, Luke Chen <showuon@gmail.com>
@ijuma
Copy link
Copy Markdown
Member Author

ijuma commented Nov 10, 2021

Merged to trunk and 3.1 branches.

stanislavkozlovski added a commit to stanislavkozlovski/kafka that referenced this pull request Nov 11, 2021
…ntegration-11-nov

* ak/trunk: (15 commits)
  KAFKA-13429: ignore bin on new modules (apache#11415)
  KAFKA-12648: introduce TopologyConfig and TaskConfig for topology-level overrides (apache#11272)
  KAFKA-12487: Add support for cooperative consumer protocol with sink connectors (apache#10563)
  MINOR: Log client disconnect events at INFO level (apache#11449)
  MINOR: Remove topic null check from `TopicIdPartition` and adjust constructor order (apache#11403)
  KAFKA-13417; Ensure dynamic reconfigurations set old config properly (apache#11448)
  MINOR: Adding a constant to denote UNKNOWN leader in LeaderAndEpoch (apache#11477)
  KAFKA-10543: Convert KTable joins to new PAPI (apache#11412)
  KAFKA-12226: Commit source task offsets without blocking on batch delivery (apache#11323)
  KAFKA-13396: Allow create topic without partition/replicaFactor (apache#11429)
  ...
xdgrulez pushed a commit to xdgrulez/kafka that referenced this pull request Dec 22, 2021
…structor order (apache#11403)

`TopicPartition` allows a null `topic` and there are cases where we have
a topic id, but no topic name. Even for `TopicIdPartition`, the non null
topic name check was only enforced in one constructor.

Also adjust the constructor order to move the nullable parameter to the
end, update tests and javadoc.

Reviewers: David Jacot <djacot@confluent.io>, Luke Chen <showuon@gmail.com>
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.

3 participants