[fix] [client] PIP-344 Do not create partitioned metadata when calling pulsarClient.getPartitionsForTopic(topicName)
Motivation
see also PIP-344 Correct the behavior of the public API pulsarClient.getPartitionsForTopic(topicName)
Background
- When calling
pulsarClient.getPartitionsForTopic(topicName), Pulsar will automatically create the partitioned topic metadata if it does not exist, either usingHttpLookupServiceorBinaryProtoLookupService. - The partitioned topic auto-creation is dependent on
pulsarClient.getPartitionsForTopic - It triggers partitioned metadata creation by
pulsarClient.getPartitionsForTopic - And triggers the topic partition creation by producers' registration and consumers' registration.
Issue
Since the method pulsarClient.getPartitionsForTopic is a public API, and it is named getxxx, it should edit nothing.
Modifications
- Do not create partitioned metadata when calling pulsarClient.getPartitionsForTopic(topicName)
Next PRs
- Section Backward & Forward Compatibility
- Section 2 of Goals: Instead of returning a 0 partitioned metadata, respond to a not found error when calling pulsarClient.getPartitionsForTopic(String) if the topic does not exist.
Documentation
- [ ]
doc - [ ]
doc-required - [x]
doc-not-needed - [ ]
doc-complete
Matching PR in forked repository
PR in forked repository: x
/pulsarbot run-failure-checks
Codecov Report
Attention: Patch coverage is 81.25000% with 18 lines in your changes are missing coverage. Please review.
Project coverage is 73.17%. Comparing base (
bbc6224) to head (2c6e826). Report is 297 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #22206 +/- ##
============================================
- Coverage 73.57% 73.17% -0.40%
- Complexity 32624 32882 +258
============================================
Files 1877 1890 +13
Lines 139502 141491 +1989
Branches 15299 15525 +226
============================================
+ Hits 102638 103537 +899
- Misses 28908 29941 +1033
- Partials 7956 8013 +57
| Flag | Coverage Δ | |
|---|---|---|
| inttests | 27.40% <30.20%> (+2.82%) |
:arrow_up: |
| systests | 24.71% <26.04%> (+0.39%) |
:arrow_up: |
| unittests | 72.19% <81.25%> (-0.66%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Files | Coverage Δ | |
|---|---|---|
| ...pulsar/broker/admin/impl/PersistentTopicsBase.java | 69.29% <100.00%> (+3.83%) |
:arrow_up: |
| ...e/pulsar/client/impl/BinaryProtoLookupService.java | 81.99% <100.00%> (-0.55%) |
:arrow_down: |
| ...apache/pulsar/client/impl/ConsumerBuilderImpl.java | 87.11% <100.00%> (+0.17%) |
:arrow_up: |
| ...g/apache/pulsar/client/impl/HttpLookupService.java | 84.95% <100.00%> (+3.70%) |
:arrow_up: |
| ...he/pulsar/client/impl/MultiTopicsConsumerImpl.java | 78.79% <100.00%> (+1.06%) |
:arrow_up: |
| .../transaction/TransactionCoordinatorClientImpl.java | 66.07% <100.00%> (+0.30%) |
:arrow_up: |
| ...va/org/apache/pulsar/common/protocol/Commands.java | 91.01% <100.00%> (+0.42%) |
:arrow_up: |
| ...java/org/apache/pulsar/common/util/FutureUtil.java | 77.04% <100.00%> (+2.50%) |
:arrow_up: |
| ...apache/pulsar/proxy/server/LookupProxyHandler.java | 45.56% <100.00%> (-15.03%) |
:arrow_down: |
| ...a/org/apache/pulsar/client/impl/LookupService.java | 0.00% <0.00%> (ø) |
|
| ... and 2 more |
Rebase master
There's a reported bug #23203 which is related to this change.