Repository navigation
[improve][broker][PIP-149]Make getList async - #16221
Conversation
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
| return new RestException(Status.NOT_FOUND, String.format( | ||
| "Partitioned Topic not found: %s %s", topicName.toString(), topicErrorType)); | ||
| } else if (!internalGetList(Optional.empty()).contains(topicName.toString())) { | ||
| } else if (!internalGetListAsync(Optional.empty()).join().contains(topicName.toString())) { |
There was a problem hiding this comment.
We need to avoid using the join() and get().
There was a problem hiding this comment.
Should we keep both internalGetList and internalGetListAsync? @nodece
There was a problem hiding this comment.
It looks like you need to make the topicNotFoundReason to async.
There was a problem hiding this comment.
There has existed a method topicNotFoundReasonAsync, but topicNotFoundReason are still invoked by getTopicReference, which appears in many methods. I think it's better to cleanup topicNotFoundReason when other methods have replaced getTopicReference with getTopicReferenceAsync.So it's looks OK using join here @nodece
There was a problem hiding this comment.
Ok, it's better using get(pulsar().getConfiguration().getMetadataStoreOperationTimeoutSeconds(), TimeUnit.SECONDS) instead of join().
There was a problem hiding this comment.
sync(() -> topicNotFoundReasonAsync()
| throw new RestException(Status.NOT_FOUND, String.format( | ||
| "Partitioned Topic not found: %s %s", topicName.toString(), topicErrorType)); | ||
| } else if (!internalGetList(Optional.empty()).contains(topicName.toString())) { | ||
| } else if (!internalGetListAsync(Optional.empty()).join().contains(topicName.toString())) { |
There was a problem hiding this comment.
We need to avoid using the join() and get().
There was a problem hiding this comment.
Thanks @nodece , I removed join in topicNotFoundReasonAsync. PTAL
| return new RestException(Status.NOT_FOUND, "Topic partitions were not yet created"); | ||
| } | ||
| } catch (Exception e) { | ||
| // failed to get reason, so fall through coarse reason |
There was a problem hiding this comment.
I think we should throw an error, or return return new RestException(Status.NOT_FOUND, e.getMessage());
You can look at other people's opinions.
There was a problem hiding this comment.
en...It seems that e.getMessage is not the real reason I think @nodece , Please take a look also @Technoboy- @Jason918
There was a problem hiding this comment.
I think you can add a new sync method called internalGetList like getPartitionedTopicMetadata.
There was a problem hiding this comment.
It looks bettter to keep the original internalGetList, and cleanup it until making all other methods async @Technoboy-
There was a problem hiding this comment.
In order to reduce the duplicated codes, you can do it like sync(() -> internalGetListAsync()
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
Co-authored-by: congbobo184 <[email protected]>
Master Issue: #14365
Motivation
Modifications
Verifying this change
Documentation
doc-not-needed