github-actions[bot] commented on code in PR #66447:
URL: https://github.com/apache/doris/pull/66447#discussion_r3713571033


##########
fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudTabletRebalancer.java:
##########
@@ -1083,6 +1097,22 @@ void fillBeToTablets(Long be, Long tableId, Long partId, 
Long indexId, Long tabl
         beToTabletsOfIndex.computeIfAbsent(be, ignored -> 
ConcurrentHashMap.newKeySet()).add(tabletId);
     }
 
+    private Function<Long, Set<Long>> newGlobalTabletSetFactory(Map<Long, 
Set<Long>> previousBeToTablets) {
+        Map<Long, Set<Long>> previousRoute = previousBeToTablets == null
+                ? Collections.emptyMap() : previousBeToTablets;
+        return be -> {
+            Set<Long> previousTablets = previousRoute.get(be);
+            int initialCapacity = previousTablets == null ? 0 : 
previousTablets.size();

Review Comment:
   [P2] Bound stale cardinality before allocating the new set
   
   `statRouteInfo()` rebuilds from the current catalog, so dropping a large 
table or database can reduce a surviving BE from millions of tablets to one 
between rounds. This passes the old count unchanged to `newKeySet`; [JDK 17 
sizes the lazily created backing table for that 
count](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/concurrent/ConcurrentHashMap.html)
 on the first `add`. The rebuild then holds old-large plus new-large instead of 
old-large plus new-small. If allocation fails before the temporary maps are 
published, `Daemon.run()` retries while the old map and same stale hint remain, 
so this can become a repeated OOME. The added test already rebuilds one tablet 
from previous sizes 3/5 but overrides the allocator, masking this behavior. 
Please bound or validate stale hints (or pre-count the current per-BE 
cardinality) and cover a sharp-shrink case.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to