-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[fix][broker] Automatically create topic for remote cluster in geo #21679
base: master
Are you sure you want to change the base?
[fix][broker] Automatically create topic for remote cluster in geo #21679
Conversation
Test cases can be added. |
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
5948f04
to
02de6e7
Compare
/pulsarbot rerun-failure-checks |
Thank @liudezhi2098 for your suggest, the I need to add a new test case with multiple configuration stores to verify #21153. |
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
ec4a1d4
to
d8d689d
Compare
Throwable throwable = FutureUtil.unwrapCompletionException(ex); | ||
if (throwable instanceof ConflictException) { | ||
int code = ((ConflictException) throwable).getStatusCode(); | ||
if (code == Status.CONFLICT.getStatusCode()) { |
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.
Maybe all the partitioned-topic tries to create topic for the remote cluster, so there will throw Conflict
exception, right?
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.
And also existed in the remote cluster?
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.
Maybe all the partitioned-topic tries to create topic for the remote cluster, so there will throw
Conflict
exception, right?
Rright. If Conflict
is thrown, it indicates that the topic already exists in the remote cluster.
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 load topic could try to create the topic in the remote cluster, the create
operation and the error log may confuse the user. So it's better to query
before create
.
Another case is: if the user updates the partition in the local cluster(like updating partition from 3~5), the remote can't update.
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 load topic could try to create the topic in the remote cluster, the
create
operation and the error log may confuse the user. So it's better toquery
beforecreate
.
The current implementation prints many logs if the topic has existed in the remote cluster. If we use the query
before create
, there are twice HTTP requests.
Another case is: if the user updates the partition in the local cluster(like updating partition from 3~5), the remote can't update.
If the user enables the geo-replication, we also need to update this topic for the remote cluster when updating the partition in the local cluster.
/pulsarbot rerun-failure-checks |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #21679 +/- ##
=============================================
- Coverage 73.29% 36.62% -36.68%
+ Complexity 32769 12145 -20624
=============================================
Files 1893 1716 -177
Lines 140745 131172 -9573
Branches 15503 14331 -1172
=============================================
- Hits 103166 48041 -55125
- Misses 29498 76726 +47228
+ Partials 8081 6405 -1676
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@nodece Is the issue happened on a shared configuration store or multiple configuration stores? |
@codelipenghui It happened on multiple configuration stores. |
@nodece Ok, I see. It think it could be a great topic to discuss under the mailing list. It should not be a fix here. It should a topic of how to handle topic creation for geo-replicated clusters with multiple configuration stores. Now, I think it's not clear enough in Pulsar. And for clusters with multiple configuration stores, users need to create the partitioned topic to multiple clusters manually. For creating the partitioned topics to the remote cluster. We might also need to take the security issues into consideration, the credential to access the remote cluster should not always be the super user . And different clusters might have different limitations, e.g. max topics. And there is another solution to sync the configuration store events across different clusters. I think it should be a related topic? |
@codelipenghui Sure, I agree with you. Usually, users need to create the topic on the remote clusters manually.
This kind of behavior has existed for a long time, perhaps we did not consider max topics. When the GEO is enabled on the namespace level, you create the topic on the local cluster, the broker also creates the topic on the remote cluster, please see: pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java Lines 676 to 690 in 44a0754
#16424 is used to sync all configuration store to another cluster. For my case, I only sync some topic to another cluster by the GEO. |
@nodece, I got your point. Is it better to return an exception to users if the remote cluster doesn't have the partitioned topic? Then, users can create the partitioned topic for the remote cluster and enable geo-replication on the topic again. The reason that I want to propose this solution is creating partitioned topics with Since it actually changed the behavior of the API. Could you please start with a PIP? |
@codelipenghui In the current implementation If the geo-replication is enabled at the namespace level, the partition topic will be auto-created at the remote clusters when creating a topic at the local cluster. |
Fixes #21153
Motivation
Enable the geo-replication only on the topic level to replicate the partitioned topic, if the topic was not created in the remote cluster, it becomes the non-partition topic by the
allowAutoTopicCreation=true
andallowAutoTopicCreationType=non-partitioned
configurations, which is not in line with the expected behavior. Therefore, I suggest that geo-replication automatically creates the topic for the remote cluster.How to reproduce this issue:
Modifications
NonPersistentTopic
andPersistentTopic
, the geo automatically creates the topic for the remote cluster.Verifying this change
GeoReplicationOnTopicLevelTest
to cover these changes.Documentation
doc
doc-required
doc-not-needed
doc-complete