-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Issue 13854][broker] Fix call sync method in async rest api for internalGetReplicatedSubscriptionStatus #13888
[Issue 13854][broker] Fix call sync method in async rest api for internalGetReplicatedSubscriptionStatus #13888
Conversation
@@ -4729,10 +4727,11 @@ private void internalGetReplicatedSubscriptionStatusForNonPartitionedTopic(Async | |||
asyncResponse.resume(new RestException(Status.METHOD_NOT_ALLOWED, | |||
"Cannot get replicated subscriptions on non-persistent topics")); | |||
} | |||
} catch (Exception e) { | |||
}).exceptionally(e -> { | |||
log.error("[{}] Failed to get replicated subscription status on {} {}", clientAppId(), | |||
topicName, subName, e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
topicName, subName, e); | |
topicName, subName, e.getCause()); |
validateTopicOwnership(topicName, authoritative); | ||
|
||
// Redirect the request to the appropriate broker if this broker is not the owner of the topic | ||
return validateTopicOwnershipAsync(topicName, authoritative).thenRun(() -> { | ||
Topic topic = getTopicReference(topicName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method can be async.
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
Outdated
Show resolved
Hide resolved
@@ -4627,26 +4627,25 @@ protected void internalGetReplicatedSubscriptionStatus(AsyncResponse asyncRespon | |||
return; | |||
} | |||
|
|||
// Reject the request if the topic is not global | |||
if (!topicName.isGlobal()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this check removed?
38941b0
to
9a895fc
Compare
/pulsarbot run-failure-checks |
} | ||
|
||
private void internalGetReplicatedSubscriptionStatusForNonPartitionedTopic(AsyncResponse asyncResponse, | ||
private void internalGetReplicatedSubscriptionStatusForNonPartitionedTopic( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make internalGetReplicatedSubscriptionStatusForNonPartitionedTopic to return CompletableFuture
then we can delete 4805~4811
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the AsyncResponse was given,the function can process any exception. The caller no need to care the result. How about this way?
.thenCompose(__ -> getPartitionedTopicMetadataAsync(topicName, authoritative, false)) | ||
.thenAccept(partitionMetadata -> { | ||
if (partitionMetadata.partitions > 0) { | ||
final List<CompletableFuture<Map<String, Boolean>>> futures = Lists.newArrayList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we know the partition number, we'd better set the initial capacity to Lists.newArrayList()
to avoid unnecessary expansion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@suiyuzeng Could you please check the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
a93f35c
The pr had no activity for 30 days, mark with Stale label. |
@suiyuzeng Please help resolve the conflicts. |
/pulsarbot run-failure-checks |
The pr had no activity for 30 days, mark with Stale label. |
5ea2ee2
to
9a1c83a
Compare
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
8713523
to
90a1cf3
Compare
/pulsarbot run-failure-checks |
Master Issue: #13854
Motivation
See #13854
Verifying this change
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
no-need-doc