[Issue 13854][Broker]Fix call sync method in async rest api for internalExpireMessagesForA… - #13905
Conversation
943f4d5 to
bd06261
Compare
bd06261 to
44451b6
Compare
| } | ||
| } | ||
|
|
||
| private CompletableFuture<Void> internalExpireMessagesByTimestampForSinglePartitionAsync(String subName, |
There was a problem hiding this comment.
@liudezhi2098 Any difference between these two?
There was a problem hiding this comment.
Both PR's modify this method,warning: There may be conflict.
There was a problem hiding this comment.
Oh, I think we'd better close the new one and apply the fix from the old one.
There was a problem hiding this comment.
Ok, I can rebase the code after #13880 merging to master to fix the conflict
| } | ||
|
|
||
| asyncResponse.resume(Response.noContent().build()); | ||
| }).exceptionally(ex -> { |
There was a problem hiding this comment.
Should this exceptionally in Line 1863?
There was a problem hiding this comment.
This exceptionally can handle getPartitionedTopicMetadataAsync exceptions if topicName.isPartitioned() return false
There was a problem hiding this comment.
This
exceptionallycan handlegetPartitionedTopicMetadataAsyncexceptions iftopicName.isPartitioned()return false
Yes, but exceptionally is also needed there for validateGlobalNamespaceOwnership
| }))); | ||
|
|
||
| asyncResponse.resume(Response.noContent().build()); | ||
| return FutureUtil.waitForAll(futures).thenRun(() -> { |
There was a problem hiding this comment.
We can use exceptionally here to handle the exceptions. No need for the exception in Line 1876
| } | ||
| } | ||
|
|
||
| private CompletableFuture<Void> internalExpireMessagesByTimestampForSinglePartitionAsync(String subName, |
There was a problem hiding this comment.
@liudezhi2098 Any difference between these two?
| return future.thenCompose(__ -> { | ||
| // If the topic name is a partition name, no need to get partition topic metadata again | ||
| if (!topicName.isPartitioned()) { | ||
| getPartitionedTopicMetadataAsync(topicName, authoritative, false) |
There was a problem hiding this comment.
Yes, there miss return
| log.error("[{}] {} {} {}", clientAppId(), msg, topicName, subName); | ||
| throw new IllegalStateException(msg); | ||
| } else { | ||
| return doInternalExpireMessagesByTimestampForSinglePartitionAsync(subName, |
There was a problem hiding this comment.
We can return a CompletableFuture.completedFuture(null) if this check is passed to avoid add another method.
There was a problem hiding this comment.
If (!topicName.isPartitioned()) && metadata.partitions == 0 , we should also doInternalExpireMessagesByTimestampForSinglePartitionAsync
44451b6 to
7f18dc6
Compare
| } | ||
|
|
||
| asyncResponse.resume(Response.noContent().build()); | ||
| }).exceptionally(ex -> { |
| .thenCompose(__ -> getTopicReferenceAsync(topicName)) | ||
| .thenCompose(t -> { | ||
| PersistentTopic topic = (PersistentTopic) t; | ||
| final AtomicReference<Throwable> exception = new AtomicReference<>(); |
There was a problem hiding this comment.
Why do we need this line? You can get the exception from the futures from line 1879 directly.
There was a problem hiding this comment.
looks the same as #13905 (comment)? I will update there code
| } | ||
| } | ||
|
|
||
| private CompletableFuture<Void> internalExpireMessagesByTimestampForSinglePartitionAsync(String subName, |
There was a problem hiding this comment.
Oh, I think we'd better close the new one and apply the fix from the old one.
7f18dc6 to
4ead34d
Compare
|
/pulsarbot run-failure-checks |
Master Issue: #13854
Motivation
See Issue: #13854
Modifications
Verifying this change
Does this pull request potentially affect one of the following parts:
If
yeswas chosen, please highlight the changesDocumentation
no-need-doc