eolivelli commented on code in PR #18193:
URL: https://github.com/apache/pulsar/pull/18193#discussion_r1006777407
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -2886,30 +2888,38 @@ public CompletableFuture<PartitionedTopicMetadata>
fetchPartitionedTopicMetadata
if (metadata.partitions == 0
&& !topicExists
&& !topicName.isPartitioned()
- &&
pulsar.getBrokerService().isAllowAutoTopicCreation(topicName, policies)
&& pulsar.getBrokerService()
.isDefaultTopicTypePartitioned(topicName, policies)) {
-
- pulsar.getBrokerService()
-
.createDefaultPartitionedTopicAsync(topicName, policies)
- .thenAccept(md ->
future.complete(md))
- .exceptionally(ex -> {
- if (ex.getCause()
- instanceof
MetadataStoreException.AlreadyExistsException) {
- // The partitioned
topic might be created concurrently
-
fetchPartitionedTopicMetadataAsync(topicName)
-
.whenComplete((metadata2, ex2) -> {
- if (ex2 ==
null) {
-
future.complete(metadata2);
- } else {
-
future.completeExceptionally(ex2);
- }
- });
- } else {
-
future.completeExceptionally(ex);
- }
- return null;
- });
+
isAllowAutoTopicCreationAsync(topicName, policies).thenAccept(allowed -> {
Review Comment:
Cache stateless is a bigger problem and I would keep that out of the scope
this patch.
This patch is following the way we do for all multi broker operations (like
delete namespace)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]