nodece commented on code in PR #23088:
URL: https://github.com/apache/pulsar/pull/23088#discussion_r1694510897


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java:
##########
@@ -1201,6 +1203,21 @@ public long estimateBacklogSize() {
     }
 
     public SubscriptionStatsImpl getStats(GetStatsOptions getStatsOptions) {
+        // So far, there is no case hits this check.
+        if (getStatsOptions.isGetEarliestTimeInBacklog()) {
+            throw new IllegalArgumentException("Calling the sync method 
subscription.getStats with"
+                    + " getEarliestTimeInBacklog, it may encountered a 
deadlock error.");
+        }
+        // The method "getStatsAsync" will be a sync method if the param 
"isGetEarliestTimeInBacklog" is false.
+        try {
+            return getStatsAsync(getStatsOptions).get(5, TimeUnit.SECONDS);

Review Comment:
   The `metadata-store` thread will be released after 30 seconds, because the 
zk client will be reconnected(I remember).
   
   So I say, your way just reduce the lock time to 5s.
   
   The sync method has been deprecated, which is used for the unit test and 
removeSubscription.
   
   <img width="908" alt="image" 
src="https://github.com/user-attachments/assets/faaeb106-205c-4b7d-9c21-976e670e9cfa";>
   
   
   



-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to