Skip to content

Commit

Permalink
Fix some async method problems at PersistentTopicsBase. (apache#6483)
Browse files Browse the repository at this point in the history
  • Loading branch information
codelipenghui authored Mar 6, 2020
1 parent 329e231 commit 47ca8e6
Show file tree
Hide file tree
Showing 2 changed files with 610 additions and 457 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -571,16 +571,24 @@ protected ZooKeeperChildrenCache failureDomainListCache() {

protected CompletableFuture<PartitionedTopicMetadata> getPartitionedTopicMetadataAsync(
TopicName topicName, boolean authoritative, boolean checkAllowAutoCreation) {
validateClusterOwnership(topicName.getCluster());
// validates global-namespace contains local/peer cluster: if peer/local cluster present then lookup can
// serve/redirect request else fail partitioned-metadata-request so, client fails while creating
// producer/consumer
validateGlobalNamespaceOwnership(topicName.getNamespaceObject());
try {
validateClusterOwnership(topicName.getCluster());
// validates global-namespace contains local/peer cluster: if peer/local cluster present then lookup can
// serve/redirect request else fail partitioned-metadata-request so, client fails while creating
// producer/consumer
validateGlobalNamespaceOwnership(topicName.getNamespaceObject());
} catch (Exception e) {
return FutureUtil.failedFuture(e);
}

try {
checkConnect(topicName);
} catch (WebApplicationException e) {
validateAdminAccessForTenant(topicName.getTenant());
try {
validateAdminAccessForTenant(topicName.getTenant());
} catch (Exception ex) {
return FutureUtil.failedFuture(ex);
}
} catch (Exception e) {
// unknown error marked as internal server error
log.warn("Unexpected error while authorizing lookup. topic={}, role={}. Error: {}", topicName,
Expand Down
Loading

0 comments on commit 47ca8e6

Please sign in to comment.