dlg99 commented on code in PR #18193:
URL: https://github.com/apache/pulsar/pull/18193#discussion_r1006188153
##########
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:
@poorbarcode
createDefaultPartitionedTopicAsync calls createPartitionedTopicAsync which
will produce AlreadyExistsException if PartitionedTopic metadata still exists
(no matter the state of deleted property) and skip topic deletion/reread
metadata.
It is ok if create tp_test-partion-0 already past the metadata check state.
broker-1 issues delete tp_test-partion-0 after the PartitionedTopic metadata
update (mark deleted) anyways.
--
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]