lhotari commented on code in PR #24833:
URL: https://github.com/apache/pulsar/pull/24833#discussion_r2466067526


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -2610,6 +2581,93 @@ protected void 
handleGetTopicsOfNamespace(CommandGetTopicsOfNamespace commandGet
         }
     }
 
+    private void internalHandleGetTopicsOfNamespace(String namespace, 
NamespaceName namespaceName, long requestId,
+                                                    
CommandGetTopicsOfNamespace.Mode mode,
+                                                    Optional<String> 
topicsPattern, Optional<String> topicsHash,
+                                                    Semaphore lookupSemaphore) 
{
+        BooleanSupplier isPermitRequestCancelled = () -> 
!ctx().channel().isActive();
+        TopicListSizeResultCache.ResultHolder
+                listSizeHolder = 
service.getTopicListSizeResultCache().getTopicListSize(namespaceName.toString(),
 mode);
+        listSizeHolder.getSizeAsync().thenAccept(initialSize -> {
+            maxTopicListInFlightLimiter.withAcquiredPermits(initialSize,
+                    AsyncDualMemoryLimiter.LimitType.HEAP_MEMORY, 
isPermitRequestCancelled, initialPermits -> {

Review Comment:
   > Just add a tip: if the data does not exist in the cache, it may query ZK, 
which will also use direct memory
   
   I agree that there might be other sources of memory allocations. One example 
is AbstractMetadataStore's childrenCache which consumes heap memory without 
bounds. #24868 addresses that. In the case of ZK, direct memory usage itself is 
fairly low.



-- 
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