Skip to content

Commit 1b91da8

Browse files
committed
[fix][broker] Don't check replication clusters for ownership of system topics
1 parent 3de14c5 commit 1b91da8

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
import org.apache.pulsar.common.policies.data.AuthAction;
118118
import org.apache.pulsar.common.policies.data.AutoSubscriptionCreationOverride;
119119
import org.apache.pulsar.common.policies.data.BacklogQuota;
120+
import org.apache.pulsar.common.policies.data.ClusterDataImpl;
120121
import org.apache.pulsar.common.policies.data.DelayedDeliveryPolicies;
121122
import org.apache.pulsar.common.policies.data.DispatchRate;
122123
import org.apache.pulsar.common.policies.data.EntryFilters;
@@ -4301,19 +4302,27 @@ public static CompletableFuture<PartitionedTopicMetadata> unsafeGetPartitionedTo
43014302
// and other vital information. Even after namespace starting deletion,,
43024303
// we need to access the metadata of system topics to create readers and clean up topic data.
43034304
// If we don't do this, it can prevent namespace deletion due to inaccessible readers.
4304-
checkLocalOrGetPeerReplicationCluster(pulsar, topicName.getNamespaceObject(), isSystemTopic(topicName))
4305-
.thenCompose(res -> pulsar.getBrokerService()
4306-
.fetchPartitionedTopicMetadataCheckAllowAutoCreationAsync(topicName))
4307-
.thenAccept(metadata -> {
4308-
if (log.isDebugEnabled()) {
4309-
log.debug("Total number of partitions for topic {} is {}", topicName,
4310-
metadata.partitions);
4311-
}
4312-
metadataFuture.complete(metadata);
4313-
}).exceptionally(ex -> {
4314-
metadataFuture.completeExceptionally(ex.getCause());
4315-
return null;
4316-
});
4305+
CompletableFuture<Void> clusterOwnershipCheck;
4306+
if (isSystemTopic(topicName)) {
4307+
clusterOwnershipCheck = CompletableFuture.completedFuture(null);
4308+
} else {
4309+
clusterOwnershipCheck =
4310+
checkLocalOrGetPeerReplicationCluster(pulsar, topicName.getNamespaceObject())
4311+
.thenApply(res -> null);
4312+
}
4313+
4314+
clusterOwnershipCheck.thenCompose(res -> pulsar.getBrokerService()
4315+
.fetchPartitionedTopicMetadataCheckAllowAutoCreationAsync(topicName))
4316+
.thenAccept(metadata -> {
4317+
if (log.isDebugEnabled()) {
4318+
log.debug("Total number of partitions for topic {} is {}", topicName,
4319+
metadata.partitions);
4320+
}
4321+
metadataFuture.complete(metadata);
4322+
}).exceptionally(ex -> {
4323+
metadataFuture.completeExceptionally(ex.getCause());
4324+
return null;
4325+
});
43174326

43184327
return metadataFuture;
43194328
}

0 commit comments

Comments
 (0)