-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[improve][broker] PIP-433: Ensure topic creation before starting GEO #24652
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
base: master
Are you sure you want to change the base?
[improve][broker] PIP-433: Ensure topic creation before starting GEO #24652
Conversation
9f91e51 to
a613da2
Compare
poorbarcode
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nodece Thanks for driving this feature
| } | ||
| // Set useFallbackForNonPIP344Brokers to true when mix of PIP-344 and non-PIP-344 brokers are used, it | ||
| // can still work. | ||
| return client.getLookup().getPartitionedTopicMetadata(baseTopicName, false, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have pulsarAdmin object, can we use pulsar-admin.topics.getPartitionedTopicMetadataAsync here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I will refactor this logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poorbarcode This is an asynchronous method, but the keyword async is missing from its name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have pulsarAdmin object, can we use pulsar-admin.topics.getPartitionedTopicMetadataAsync here?
I have modified the code, please review it. f7d38d7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poorbarcode Good, I should use pulsarAdmin instead of pulsarClient, this is better way.
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/OneWayReplicatorTest.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/OneWayReplicatorTest.java
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/OneWayReplicatorTest.java
Show resolved
Hide resolved
|
Rebase master |
a47eb1f to
4c833ed
Compare
90de7bd to
36661e4
Compare
|
The tests The new code has been refactored by the AI. |
|
ping @poorbarcode |
|
@nodece I will review the PR again by this weekend |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #24652 +/- ##
=============================================
+ Coverage 38.90% 74.50% +35.60%
- Complexity 13246 33699 +20453
=============================================
Files 1842 1899 +57
Lines 145553 149746 +4193
Branches 16920 17413 +493
=============================================
+ Hits 56632 111575 +54943
+ Misses 81267 29289 -51978
- Partials 7654 8882 +1228
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
36661e4 to
f2e4b5c
Compare
62df37d to
b5953d9
Compare
PIP: #24485
Motivation
In a GEO replication scenario, if the remote cluster does not have the replicated topic and the auto-creation type differs between the local and remote clusters, message replication may fail. To ensure seamless replication, the topic metadata must be properly synchronized across clusters.
This is part of PIP-433.
#24136 is the same as this PR.
Modifications
When both the local and remote partitioned topic metadata indicate
partitions=0, this means the topic is non-partitioned. In this case, the local cluster sends a non-partitioned topic creation request to the remote cluster.If the local partitioned topic metadata has
partitions>0, this means the topic is partitioned:partitions=0, the local cluster sends a partitioned topic creation request to the remote cluster.Documentation
docdoc-requireddoc-not-neededdoc-complete