Add more config for auto-topic-creation#4963
Conversation
sijie
left a comment
There was a problem hiding this comment.
@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 |
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.
@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.
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.