Skip to content
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

Conversation

suiyuzeng
Copy link
Contributor

Master Issue: #13854

Motivation

See #13854

Verifying this change

  • Make sure that the change passes the CI checks.

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Documentation

  • no-need-doc

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);
Copy link
Member

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.

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jan 21, 2022
@@ -4627,26 +4627,25 @@ protected void internalGetReplicatedSubscriptionStatus(AsyncResponse asyncRespon
return;
}

// Reject the request if the topic is not global
if (!topicName.isGlobal()) {
Copy link
Contributor

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?

@suiyuzeng suiyuzeng force-pushed the sync_call_issue_internalGetReplicatedSubscriptionStatus branch 4 times, most recently from 38941b0 to 9a895fc Compare January 25, 2022 05:28
Jason918
Jason918 previously approved these changes Jan 25, 2022
@Jason918
Copy link
Contributor

/pulsarbot run-failure-checks

}

private void internalGetReplicatedSubscriptionStatusForNonPartitionedTopic(AsyncResponse asyncResponse,
private void internalGetReplicatedSubscriptionStatusForNonPartitionedTopic(
Copy link
Contributor

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

Copy link
Contributor Author

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?

@Jason918
Copy link
Contributor

mattisonchao
mattisonchao previously approved these changes Jan 27, 2022
.thenCompose(__ -> getPartitionedTopicMetadataAsync(topicName, authoritative, false))
.thenAccept(partitionMetadata -> {
if (partitionMetadata.partitions > 0) {
final List<CompletableFuture<Map<String, Boolean>>> futures = Lists.newArrayList();
Copy link
Member

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.

Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

codelipenghui
codelipenghui previously approved these changes Jan 28, 2022
@suiyuzeng
Copy link
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@Jason918
Copy link
Contributor

/pulsarbot run-failure-checks

@github-actions
Copy link

The pr had no activity for 30 days, mark with Stale label.

@Jason918
Copy link
Contributor

@suiyuzeng Please help resolve the conflicts.

@suiyuzeng
Copy link
Contributor Author

/pulsarbot run-failure-checks

@Jason918
Copy link
Contributor

@github-actions
Copy link

The pr had no activity for 30 days, mark with Stale label.

@suiyuzeng suiyuzeng force-pushed the sync_call_issue_internalGetReplicatedSubscriptionStatus branch 2 times, most recently from 5ea2ee2 to 9a1c83a Compare April 21, 2022 08:35
@suiyuzeng
Copy link
Contributor Author

/pulsarbot run-failure-checks

@suiyuzeng
Copy link
Contributor Author

/pulsarbot run-failure-checks

@suiyuzeng suiyuzeng force-pushed the sync_call_issue_internalGetReplicatedSubscriptionStatus branch from 8713523 to 90a1cf3 Compare April 24, 2022 02:12
@suiyuzeng
Copy link
Contributor Author

/pulsarbot run-failure-checks

@Jason918 Jason918 merged commit 43ce8ef into apache:master Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants