poorbarcode commented on code in PR #23258:
URL: https://github.com/apache/pulsar/pull/23258#discussion_r1749751058


##########
pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactedTopicImpl.java:
##########
@@ -304,8 +306,10 @@ static CompletableFuture<List<Entry>> 
readEntries(LedgerHandle lh, long from, lo
      * Getter for CompactedTopicContext.
      * @return CompactedTopicContext
      */
-    public Optional<CompactedTopicContext> getCompactedTopicContext() throws 
ExecutionException, InterruptedException {
-        return compactedTopicContext == null ? Optional.empty() : 
Optional.of(compactedTopicContext.get());
+    public Optional<CompactedTopicContext> getCompactedTopicContext() throws 
ExecutionException, InterruptedException,

Review Comment:
   I added a new async method `getCompactedTopicContextAsync`, so there are two 
methods now
   - `getCompactedTopicContext`
   - `getCompactedTopicContextAsync`
   
   There are `2` places that are calling the old method 
`getCompactedTopicContext`
   - `topic internal stats`
   - `HTTP requests: /metrics/`
   
   I have changed the first use-case to `getCompactedTopicContextAsync` in the 
current PR, and the second one is hard to modify, we can separate a PR to 
improve the second case. And I added a timeout `30s` for the second case, which 
is better than calling it without a timeout.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to