-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add more config for auto-topic-creation #4963
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
Add more config for auto-topic-creation #4963
Conversation
sijie
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.
@fxbing it is a nice motivation. but I am feeling that you didn't change the code in the right place. the change in fetchPartitionedTopicMetadataAsync will introduce unnecessary creation of partitioned topic. The auto-creation happens when a producer or a consumer connects to broker. so I think the change should be done in BrokerService. You can check the methods getOrCreateTopic.
Also change "partition" and "non-partition" to "partitioned" and "non-partitioned". It might be also worth considering adding an enum like TopicType?
I first thought about making changes in the BrokerService, but when the client requests to create a Producer or Consumer, it will first get partitions info from zk, decide whether to create partitioned or non-partitioned. When the request arrives at the BrokerService, the client has decided to create a nonpartitioned Producer or Consumer. If the Broker's configuration requires automatic creation of a partitioned topic, Broker needs to send the configuration information to client, client re-establishes the partitioned Producer or Consumer, and the BrokerService updates the partitions in the zk. I think it's easier to make changes when the client creates the type that determines the creation, and need fewer communications. Do I need to modify it as I said above? |
OK, I will make a change. |
|
run java8 tests |
|
run Integration Tests |
sijie
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.
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
Outdated
Show resolved
Hide resolved
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
Outdated
Show resolved
Hide resolved
5e7a633 to
0877f77
Compare
|
run C++ / Python Tests |
|
run cpp tests |
c4382da to
de35875
Compare
|
run cpp tests |
|
run cpp tests |
2 similar comments
|
run cpp tests |
|
run cpp tests |
580d8a7 to
a068ba3
Compare
c2e0629 to
fd5da63
Compare
|
run integration tests |
|
run java8 tests |
|
PTAL @sijie @jiazhai @codelipenghui |
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.
@fxbing Nice work!
Overall looks good to me, just left a suggestion
| return metadataFuture; | ||
| } | ||
|
|
||
| protected static CompletableFuture<PartitionedTopicMetadata> createDefaultPartitionedTopicAsync( |
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 this method is no longer an asynchronous method, it's better to rename it to createDefaultPartitionedTopic()
|
@jiazhai @jennifer88huang can you please make sure this feature is well documented? |
|
Got it. |
Master Issue: #4926 Curently the partitioned-topic and non-partitioned topic is a little confuse for users. in PR #3450 we add config for auto-topic-creation. We could leverage this config to provide some more config for auto-topic-creation. - Add `allowAutoTopicCreationType` and `allowAutoTopicCreationNumPartitions` to configuration. - Users can use both configurations when they decide to create a topic automatically. - Add test. - Update doc. (cherry picked from commit 547c421)
Master Issue: #4926
Motivation
Curently the partitioned-topic and non-partitioned topic is a little confuse for users. in PR #3450 we add config for auto-topic-creation.
We could leverage this config to provide some more config for auto-topic-creation.
Modifications
allowAutoTopicCreationTypeandallowAutoTopicCreationNumPartitionsto configuration.